send-stream
Version:
Streaming file serving library with Range and conditional-GET support from file system or any streaming sources.
219 lines • 6.88 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DoesNotExistError = exports.IsDirectoryError = exports.TrailingSlashError = exports.ForbiddenCharacterError = exports.IgnoredFileError = exports.ConsecutiveSlashesError = exports.InvalidPathError = exports.NotNormalizedError = exports.MalformedPathError = exports.FileSystemStorageError = void 0;
const errors_1 = require("./errors");
/**
* File system storage error
*/
class FileSystemStorageError extends errors_1.StorageError {
/**
* Create file system storage error
* @param message - error message
* @param path - encoded path or path parts
* @param pathParts - path parts relative to root
*/
constructor(message, path, pathParts) {
super(message, path);
/**
* Path parts
*/
Object.defineProperty(this, "pathParts", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.name = 'FileSystemStorageError';
this.pathParts = pathParts;
}
}
exports.FileSystemStorageError = FileSystemStorageError;
/**
* File system storage error
*/
class MalformedPathError extends FileSystemStorageError {
/**
* Create file system storage error
* @param message - error message
* @param path - encoded path or path parts
* @param pathParts - path parts relative to root
*/
constructor(message, path, pathParts) {
super(message, path, pathParts);
this.name = 'MalformedPathError';
}
}
exports.MalformedPathError = MalformedPathError;
/**
* File system storage error
*/
class NotNormalizedError extends FileSystemStorageError {
/**
* Create file system storage error
* @param message - error message
* @param path - encoded path
* @param pathParts - path parts relative to root
* @param normalizedPath - encoded path or path parts
*/
constructor(message, path, pathParts, normalizedPath) {
super(message, path, pathParts);
/**
* Normalized path
*/
Object.defineProperty(this, "normalizedPath", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.name = 'NotNormalizedError';
this.normalizedPath = normalizedPath;
}
}
exports.NotNormalizedError = NotNormalizedError;
/**
* File system storage error
*/
class InvalidPathError extends FileSystemStorageError {
/**
* Create file system storage error
* @param message - error message
* @param path - encoded path or path parts
* @param pathParts - path parts relative to root
*/
constructor(message, path, pathParts) {
super(message, path, pathParts);
this.name = 'InvalidPathError';
}
}
exports.InvalidPathError = InvalidPathError;
/**
* File system storage error
*/
class ConsecutiveSlashesError extends FileSystemStorageError {
/**
* Create file system storage error
* @param message - error message
* @param path - encoded path or path parts
* @param pathParts - path parts relative to root
*/
constructor(message, path, pathParts) {
super(message, path, pathParts);
this.name = 'ConsecutiveSlashesError';
}
}
exports.ConsecutiveSlashesError = ConsecutiveSlashesError;
/**
* File system storage error
*/
class IgnoredFileError extends FileSystemStorageError {
/**
* Create file system storage error
* @param message - error message
* @param path - encoded path or path parts
* @param pathParts - path parts relative to root
*/
constructor(message, path, pathParts) {
super(message, path, pathParts);
this.name = 'IgnoredFileError';
}
}
exports.IgnoredFileError = IgnoredFileError;
/**
* File system storage error
*/
class ForbiddenCharacterError extends FileSystemStorageError {
/**
* Create file system storage error
* @param message - error message
* @param path - encoded path or path parts
* @param pathParts - path parts relative to root
*/
constructor(message, path, pathParts) {
super(message, path, pathParts);
this.name = 'ForbiddenCharacterError';
}
}
exports.ForbiddenCharacterError = ForbiddenCharacterError;
/**
* File system storage error
*/
class TrailingSlashError extends FileSystemStorageError {
/**
* Create file system storage error
* @param message - error message
* @param path - encoded path or path parts
* @param pathParts - path parts relative to root
* @param untrailedPathParts - path parts relative to root (without trailing slash)
*/
constructor(message, path, pathParts, untrailedPathParts) {
super(message, path, pathParts);
/**
* Path parts (without trailing slash)
*/
Object.defineProperty(this, "untrailedPathParts", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.name = 'TrailingSlashError';
this.untrailedPathParts = untrailedPathParts;
}
}
exports.TrailingSlashError = TrailingSlashError;
/**
* File system storage error
*/
class IsDirectoryError extends FileSystemStorageError {
/**
* Create file system storage error
* @param message - error message
* @param path - encoded path or path parts
* @param pathParts - path parts
* @param resolvedPath - resolved path
*/
constructor(message, path, pathParts, resolvedPath) {
super(message, path, pathParts);
/**
* Resolved path
*/
Object.defineProperty(this, "resolvedPath", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.name = 'IsDirectoryError';
this.resolvedPath = resolvedPath;
}
}
exports.IsDirectoryError = IsDirectoryError;
/**
* File system storage error
*/
class DoesNotExistError extends FileSystemStorageError {
/**
* Create file system storage error
* @param message - error message
* @param path - encoded path or path parts
* @param pathParts - path parts
* @param resolvedPath - resolved path
*/
constructor(message, path, pathParts, resolvedPath) {
super(message, path, pathParts);
/**
* Resolved path
*/
Object.defineProperty(this, "resolvedPath", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.name = 'DoesNotExistError';
this.resolvedPath = resolvedPath;
}
}
exports.DoesNotExistError = DoesNotExistError;
//# sourceMappingURL=file-system-errors.js.map