-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy patherrors.ts
55 lines (41 loc) · 1.51 KB
/
errors.ts
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2022 DeepL SE (https://www.deepl.com)
// Use of this source code is governed by an MIT
// license that can be found in the LICENSE file.
import { DocumentHandle } from './index';
export class DeepLError extends Error {
public error?: Error;
constructor(message: string, error?: Error) {
super(message);
this.message = message;
this.error = error;
}
}
export class AuthorizationError extends DeepLError {}
export class QuotaExceededError extends DeepLError {}
export class TooManyRequestsError extends DeepLError {}
export class ConnectionError extends DeepLError {
shouldRetry: boolean;
constructor(message: string, shouldRetry?: boolean, error?: Error) {
super(message, error);
this.shouldRetry = shouldRetry || false;
}
}
export class DocumentTranslationError extends DeepLError {
public readonly documentHandle?: DocumentHandle;
constructor(message: string, handle?: DocumentHandle, error?: Error) {
super(message, error);
this.documentHandle = handle;
}
}
export class GlossaryNotFoundError extends DeepLError {}
export class DocumentNotReadyError extends DeepLError {}
/**
* Error thrown if an error occurs during the minification phase.
* @see DocumentMinifier.minifyDocument
*/
export class DocumentMinificationError extends DeepLError {}
/**
* Error thrown if an error occurs during the deminification phase.
* @see DocumentMinifier.deminifyDocument
*/
export class DocumentDeminificationError extends DeepLError {}