-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathXsollaException.ts
35 lines (29 loc) · 913 Bytes
/
XsollaException.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
/**
* @link https://developers.xsolla.com/api/v2/getting-started/#api_webhooks_errors
*/
export type XsollaExceptionCode = 'INVALID_USER' | 'INVALID_PARAMETER' | 'INVALID_SIGNATURE' | 'INCORRECT_AMOUNT' | 'INCORRECT_INVOICE';
export default abstract class XsollaException extends Error {
/**
* Xsolla Error Code
*
* @link https://developers.xsolla.com/api/v2/getting-started/#api_webhooks_errors
*/
public abstract readonly name: XsollaExceptionCode;
/**
* User friendly error message.
*/
public abstract readonly message: string;
/**
* HTTP response code for Xsolla exception.
*/
public abstract readonly httpResponseCode: number;
/**
* Response to be given to an incoming Xsolla Webhook request.
*/
public jsonResponse() {
return {
code: this.name,
message: this.message,
}
}
}