Storage Service Custom Error Classes (src/errors.ts)

fastgpt · sdk/storage/src/errors.ts · typescript · Apache-2.0
files, database, integration, lang:typescript, tag:errors

Defines custom error types for object storage operations like missing buckets, permission issues, and invalid keys. Reuse when building S3-compatible storage wrappers.

// Source: https://github.com/labring/fastgpt | License: Apache-2.0 | Copyright 2023 Sealos
// Provided via justclaw.it.com; keep this notice with the code.
export class NoSuchBucketError extends Error {
  constructor(message: string) {
    super(message);
    this.name = 'NoSuchBucketError';
  }
}

export class NoBucketReadPermissionError extends Error {
  constructor(message: string) {
    super(message);
    this.name = 'NoBucketReadPermissionError';
  }
}

export class EmptyObjectError extends Error {
  constructor(message: string) {
    super(message);
    this.name = 'EmptyObjectError';
  }
}

export type InvalidStorageObjectKeyReason =
  | 'invalid_type'
  | 'empty'
  | 'invalid_unicode'
  | 'too_long'
  | 'leading_slash'
  | 'backslash'
  | 'empty_path_segment'
  | 'dot_path_segmen

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key