File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 18
18
*/
19
19
20
20
import { IncomingHttpHeaders } from "http" ;
21
+ import { ApiError } from "../typings/apiError" ;
21
22
22
23
interface ExceptionInterface {
23
24
message : string ;
24
25
statusCode ?: number ;
25
26
errorCode ?: string ;
26
27
responseHeaders ?: IncomingHttpHeaders ;
27
28
responseBody ?: string ;
29
+ apiError ?: ApiError ; // model of the error returned by the API
28
30
}
29
31
30
32
class HttpClientException extends Error {
@@ -33,6 +35,7 @@ class HttpClientException extends Error {
33
35
public responseHeaders ?: IncomingHttpHeaders ;
34
36
public readonly name : string ;
35
37
public responseBody ?: string ;
38
+ public apiError ?: ApiError ;
36
39
37
40
public constructor ( props : ExceptionInterface ) {
38
41
super ( props . message ) ;
@@ -44,6 +47,7 @@ class HttpClientException extends Error {
44
47
if ( props . responseBody ) this . responseBody = props . responseBody ;
45
48
if ( props . errorCode ) this . errorCode = props . errorCode ;
46
49
if ( props . statusCode ) this . statusCode = props . statusCode ;
50
+ if ( props . apiError ) this . apiError = props . apiError ;
47
51
}
48
52
}
49
53
Original file line number Diff line number Diff line change 17
17
* See the LICENSE file for more info.
18
18
*/
19
19
20
- // Generated using typescript-generator version 2.14.505 on 2019-06-04 08:51:10.
21
-
20
+ // ApiError interface to model Adyen API errors
21
+ // The interface is an union of the 2 different error models used by Adyen APIs:
22
+ // RestServiceError (based on RFC 7807)
23
+ // ServiceError (based on the original Adyen error model).
22
24
export interface ApiError {
23
25
status ?: number ;
24
26
errorCode ?: string ;
25
27
message ?: string ;
26
28
errorType ?: string ;
27
29
pspReference ?: string ;
30
+
31
+ detail ?: string
32
+ instance ?: string ;
33
+ invalidFields ?: Array < string > ;
34
+ requestId ?: string ;
35
+ title ?: string ;
36
+ type ?: string ;
28
37
}
You can’t perform that action at this time.
0 commit comments