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

21 lines
606 B
JavaScript
Raw Normal View History

2019-05-12 20:26:32 +02:00
export const STORE_NAMES = Object.freeze(["session", "roomState", "roomSummary", "timelineEvents", "timelineFragments"]);
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);
}
}