UNPKG

dreamstate

Version:

Store management library based on react context and observers

30 lines (27 loc) 1 kB
import { __extends } from 'tslib'; import { mapDreamstateErrorMessage } from './mapErrorMessage.js'; import { EDreamstateErrorCode } from '../../types/error.js'; /** * A custom error class that contains generic error information for Dreamstate-related issues. * * This class extends the native `Error` class and is used to represent errors specific * to the Dreamstate library, providing more structured error handling. */ var DreamstateError = /** @class */function (_super) { __extends(DreamstateError, _super); function DreamstateError(code, detail) { if (code === void 0) { code = EDreamstateErrorCode.UNEXPECTED_ERROR; } var _this = _super.call(this) || this; /** * Name or error class to help differentiate error class in minified environments. */ _this.name = "DreamstateError"; _this.code = code; _this.message = mapDreamstateErrorMessage(code, detail); return _this; } return DreamstateError; }(Error); export { DreamstateError };