@ayonli/jsext
Version:
A JavaScript extension package for building strong and modern applications.
99 lines (95 loc) • 3.35 kB
JavaScript
;
var error = require('../error.js');
var error_Exception = require('../error/Exception.js');
/**
* This error indicates that the operation is invalid, such as trying to copy a
* directory without the `recursive` option.
*
* NOTE: This error has an HTTP-compatible code of `400`.
*/
class InvalidOperationError extends error_Exception.default {
constructor(message, options = {}) {
super(message, { ...options, name: "InvalidOperationError", code: 400 });
}
}
error.registerErrorType(InvalidOperationError);
/**
* This error indicates that an operation cannot be performed because the target
* path is a directory while a file is expected.
*
* NOTE: This error has an HTTP-compatible code of `400`.
*/
class IsDirectoryError extends error_Exception.default {
constructor(message, options = {}) {
super(message, { ...options, name: "IsDirectoryError", code: 400 });
}
}
error.registerErrorType(IsDirectoryError);
/**
* This error indicates that an operation cannot be performed because the target
* path is a file while a directory is expected.
*
* NOTE: This error has an HTTP-compatible code of `400`.
*/
class NotDirectoryError extends error_Exception.default {
constructor(message, options = {}) {
super(message, { ...options, name: "NotDirectoryError", code: 400 });
}
}
error.registerErrorType(NotDirectoryError);
/**
* This error indicates that the file is too large, or the file system doesn't
* have enough space to store the new content.
*
* NOTE: This error has an HTTP-compatible code of `413`.
*/
class FileTooLargeError extends error_Exception.default {
constructor(message, options = {}) {
super(message, { ...options, name: "FileTooLargeError", code: 413 });
}
}
error.registerErrorType(FileTooLargeError);
/**
* This error indicates that too many symbolic links were encountered when
* resolving the filename.
*
* NOTE: This error has an HTTP-compatible code of `508`.
*/
class FilesystemLoopError extends error_Exception.default {
constructor(message, options = {}) {
super(message, { ...options, name: "FilesystemLoopError", code: 508 });
}
}
error.registerErrorType(FilesystemLoopError);
/**
* This error indicates that the file is busy at the moment, such as being
* locked by another program.
*
* NOTE: This error has an HTTP-compatible code of `423`.
*/
class BusyError extends error_Exception.default {
constructor(message, options = {}) {
super(message, { ...options, name: "BusyError", code: 423 });
}
}
error.registerErrorType(BusyError);
/**
* This error indicates that the operation is interrupted by the underlying file
* system.
*
* NOTE: This error has an HTTP-compatible code of `500`.
*/
class InterruptedError extends error_Exception.default {
constructor(message, options = {}) {
super(message, { ...options, name: "InterruptedError", code: 500 });
}
}
error.registerErrorType(InterruptedError);
exports.BusyError = BusyError;
exports.FileTooLargeError = FileTooLargeError;
exports.FilesystemLoopError = FilesystemLoopError;
exports.InterruptedError = InterruptedError;
exports.InvalidOperationError = InvalidOperationError;
exports.IsDirectoryError = IsDirectoryError;
exports.NotDirectoryError = NotDirectoryError;
//# sourceMappingURL=errors.js.map