1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

pass lazy loading flag into error, to format message based on it

This commit is contained in:
Bruno Windels
2018-09-26 16:12:30 +01:00
parent 78a5a88638
commit 2d5eb920b8
2 changed files with 3 additions and 2 deletions

View File

@@ -1,11 +1,12 @@
// can't just do InvalidStoreError extends Error
// because of http://babeljs.io/docs/usage/caveats/#classes
function InvalidStoreError(reason) {
function InvalidStoreError(reason, value) {
const message = `Store is invalid because ${reason}, ` +
`please delete all data and retry`;
const instance = Reflect.construct(Error, [message]);
Reflect.setPrototypeOf(instance, Reflect.getPrototypeOf(this));
instance.reason = reason;
instance.value = value;
return instance;
}