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 += ": ";
|
|
|
|
if (cause.name) {
|
|
|
|
fullMessage += `(${cause.name}) `;
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|