You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
26 lines
845 B
JavaScript
26 lines
845 B
JavaScript
// can't just do InvalidStoreError extends Error
|
|
// because of http://babeljs.io/docs/usage/caveats/#classes
|
|
function InvalidStoreError(reason, value) {
|
|
const message = `Store is invalid because ${reason}, ` +
|
|
`please stop the client, delete all data and start the client again`;
|
|
const instance = Reflect.construct(Error, [message]);
|
|
Reflect.setPrototypeOf(instance, Reflect.getPrototypeOf(this));
|
|
instance.reason = reason;
|
|
instance.value = value;
|
|
return instance;
|
|
}
|
|
|
|
InvalidStoreError.TOGGLED_LAZY_LOADING = "TOGGLED_LAZY_LOADING";
|
|
|
|
InvalidStoreError.prototype = Object.create(Error.prototype, {
|
|
constructor: {
|
|
value: Error,
|
|
enumerable: false,
|
|
writable: true,
|
|
configurable: true,
|
|
},
|
|
});
|
|
Reflect.setPrototypeOf(InvalidStoreError, Error);
|
|
|
|
module.exports.InvalidStoreError = InvalidStoreError;
|