aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/data/common.ts
blob: 35934a299fc8ce6ad184f3bb9d468a81e5f73906 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import localforage from 'localforage';

import { HttpNetworkError } from '../http/common';

export const dataStorage = localforage.createInstance({
  name: 'data',
  description: 'Database for offline data.',
  driver: localforage.INDEXEDDB,
});

export class ForbiddenError extends Error {
  constructor(message?: string) {
    super(message);
  }
}

export function throwIfNotNetworkError(e: unknown): void {
  if (!(e instanceof HttpNetworkError)) {
    throw e;
  }
}