mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
dedupe some code here
This commit is contained in:
parent
4c4687a05f
commit
3ded5b20d3
@ -33,15 +33,10 @@ export class IDBError extends StorageError {
|
|||||||
storeName: string;
|
storeName: string;
|
||||||
databaseName: string;
|
databaseName: string;
|
||||||
|
|
||||||
constructor(message: string, source: IDBIndex | IDBCursor | IDBObjectStore, cause: DOMException | null = null) {
|
constructor(message: string, sourceOrCursor: IDBIndex | IDBCursor | IDBObjectStore, cause: DOMException | null = null) {
|
||||||
let storeName: string, databaseName: string;
|
const source = "source" in sourceOrCursor ? sourceOrCursor.source : sourceOrCursor;
|
||||||
if (source instanceof IDBCursor) {
|
const storeName = _sourceName(source);
|
||||||
storeName = _sourceName(source.source);
|
const databaseName = _sourceDatabase(source);
|
||||||
databaseName = _sourceDatabase(source.source);
|
|
||||||
} else {
|
|
||||||
storeName = _sourceName(source);
|
|
||||||
databaseName = _sourceDatabase(source);
|
|
||||||
}
|
|
||||||
let fullMessage = `${message} on ${databaseName}.${storeName}`;
|
let fullMessage = `${message} on ${databaseName}.${storeName}`;
|
||||||
if (cause) {
|
if (cause) {
|
||||||
fullMessage += ": ";
|
fullMessage += ": ";
|
||||||
|
Loading…
Reference in New Issue
Block a user