diff --git a/src/client.js b/src/client.js index ee501ec0a..d5ba14e58 100644 --- a/src/client.js +++ b/src/client.js @@ -3120,7 +3120,7 @@ MatrixClient.prototype.startClient = async function(opts) { const shouldClear = await this._wasLazyLoadingToggled(opts.lazyLoadMembers); if (shouldClear) { const reason = InvalidStoreError.TOGGLED_LAZY_LOADING; - throw new InvalidStoreError(reason); + throw new InvalidStoreError(reason, !!opts.lazyLoadMembers); } if (opts.lazyLoadMembers && this._crypto) { this._crypto.enableLazyLoading(); diff --git a/src/errors.js b/src/errors.js index d26a8647f..04e14f2c8 100644 --- a/src/errors.js +++ b/src/errors.js @@ -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; }