mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-25 20:45:10 +01:00
33 lines
783 B
JavaScript
33 lines
783 B
JavaScript
export const STORE_NAMES = Object.freeze([
|
|
"session",
|
|
"roomState",
|
|
"roomSummary",
|
|
"timelineEvents",
|
|
"timelineFragments",
|
|
"pendingEvents",
|
|
]);
|
|
|
|
export const STORE_MAP = Object.freeze(STORE_NAMES.reduce((nameMap, name) => {
|
|
nameMap[name] = name;
|
|
return nameMap;
|
|
}, {}));
|
|
|
|
export class StorageError extends Error {
|
|
constructor(message, cause, value) {
|
|
let fullMessage = message;
|
|
if (cause) {
|
|
fullMessage += ": ";
|
|
if (cause.name) {
|
|
fullMessage += `(${cause.name}) `;
|
|
}
|
|
fullMessage += cause.message;
|
|
}
|
|
super(fullMessage);
|
|
if (cause) {
|
|
this.errcode = cause.name;
|
|
}
|
|
this.cause = cause;
|
|
this.value = value;
|
|
}
|
|
}
|