2019-07-01 10:00:29 +02:00
|
|
|
export const STORE_NAMES = Object.freeze([
|
|
|
|
"session",
|
|
|
|
"roomState",
|
|
|
|
"roomSummary",
|
|
|
|
"timelineEvents",
|
|
|
|
"timelineFragments",
|
|
|
|
"pendingEvents",
|
|
|
|
]);
|
2019-04-04 09:27:31 +02:00
|
|
|
|
|
|
|
export const STORE_MAP = Object.freeze(STORE_NAMES.reduce((nameMap, name) => {
|
|
|
|
nameMap[name] = name;
|
|
|
|
return nameMap;
|
|
|
|
}, {}));
|
2019-06-26 22:00:50 +02:00
|
|
|
|
|
|
|
export class StorageError extends Error {
|
2019-10-12 22:19:16 +02:00
|
|
|
constructor(message, cause, value) {
|
2019-06-26 22:00:50 +02:00
|
|
|
let fullMessage = message;
|
|
|
|
if (cause) {
|
|
|
|
fullMessage += ": ";
|
2019-11-21 18:28:18 +01:00
|
|
|
if (typeof cause.name === "string") {
|
|
|
|
fullMessage += `(name: ${cause.name}) `;
|
|
|
|
}
|
|
|
|
if (typeof cause.code === "number") {
|
|
|
|
fullMessage += `(code: ${cause.name}) `;
|
2019-06-26 22:00:50 +02:00
|
|
|
}
|
|
|
|
fullMessage += cause.message;
|
|
|
|
}
|
|
|
|
super(fullMessage);
|
2019-07-26 22:03:57 +02:00
|
|
|
if (cause) {
|
|
|
|
this.errcode = cause.name;
|
|
|
|
}
|
2019-10-12 22:19:16 +02:00
|
|
|
this.cause = cause;
|
|
|
|
this.value = value;
|
2019-06-26 22:00:50 +02:00
|
|
|
}
|
|
|
|
}
|