-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patherrors.ts
More file actions
31 lines (28 loc) · 875 Bytes
/
Copy patherrors.ts
File metadata and controls
31 lines (28 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* errors.ts
* ---------
* The error hierarchy. Everything the SDK throws or rejects with extends
* `LaylaError`, so consumers can `catch (e) { if (e instanceof LaylaError) ... }`.
*/
export class LaylaError extends Error {
constructor(message: string) {
super(message);
this.name = 'LaylaError';
}
}
export class LaylaAbortError extends LaylaError {
constructor(message = 'Request was aborted') {
super(message);
this.name = 'LaylaAbortError';
}
}
export class LaylaBridgeUnavailableError extends LaylaError {
constructor() {
super(
'Layla bridge unavailable: window.ReactNativeWebView is not present. ' +
'Make sure this code runs inside the Layla WebView and that the ' +
'<WebView> has its `onMessage` prop set (that is what injects the bridge).',
);
this.name = 'LaylaBridgeUnavailableError';
}
}