node-darts
Version:
Node.js Native Addon for Darts (Double-ARray Trie System)
50 lines • 1.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BuildError = exports.InvalidDictionaryError = exports.FileNotFoundError = exports.DartsError = void 0;
/* eslint-disable max-classes-per-file */
/**
* Base error class for Darts library
*/
class DartsError extends Error {
constructor(message) {
super(message);
this.name = 'DartsError';
// Correctly set the prototype chain for Error object
Object.setPrototypeOf(this, DartsError.prototype);
}
}
exports.DartsError = DartsError;
/**
* Error class for when a file is not found
*/
class FileNotFoundError extends DartsError {
constructor(filePath) {
super(`File not found: ${filePath}`);
this.name = 'FileNotFoundError';
Object.setPrototypeOf(this, FileNotFoundError.prototype);
}
}
exports.FileNotFoundError = FileNotFoundError;
/**
* Error class for when a dictionary file is invalid
*/
class InvalidDictionaryError extends DartsError {
constructor(message) {
super(`Invalid dictionary: ${message}`);
this.name = 'InvalidDictionaryError';
Object.setPrototypeOf(this, InvalidDictionaryError.prototype);
}
}
exports.InvalidDictionaryError = InvalidDictionaryError;
/**
* Error class for dictionary build errors
*/
class BuildError extends DartsError {
constructor(message) {
super(`Build error: ${message}`);
this.name = 'BuildError';
Object.setPrototypeOf(this, BuildError.prototype);
}
}
exports.BuildError = BuildError;
//# sourceMappingURL=errors.js.map