vector-im-hydrogen-web/src/matrix/storage/common.js

28 lines
650 B
JavaScript
Raw Normal View History

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;
}, {}));
export class StorageError extends Error {
constructor(message, cause) {
let fullMessage = message;
if (cause) {
fullMessage += ": ";
if (cause.name) {
fullMessage += `(${cause.name}) `;
}
fullMessage += cause.message;
}
super(fullMessage);
}
}