File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @gcforms/connectors" ,
3
- "version" : " 2.0.2 " ,
3
+ "version" : " 2.0.3 " ,
4
4
"author" : " Canadian Digital Service" ,
5
5
"license" : " MIT" ,
6
6
"publishConfig" : {
Original file line number Diff line number Diff line change 1
1
import { getAwsSecret } from "./getAwsSecret" ;
2
- import axios from "axios" ;
2
+ import axios , { AxiosError } from "axios" ;
3
3
4
4
const API_URL : string = "https://api.notification.canada.ca" ;
5
5
@@ -57,6 +57,7 @@ export class GCNotifyConnector {
57
57
} ) ;
58
58
} catch ( error ) {
59
59
let errorMessage = "" ;
60
+
60
61
if ( axios . isAxiosError ( error ) ) {
61
62
if ( error . response ) {
62
63
/*
@@ -73,7 +74,14 @@ export class GCNotifyConnector {
73
74
* is an instance of XMLHttpRequest in the browser and an instance
74
75
* of http.ClientRequest in Node.js
75
76
*/
76
- errorMessage = `Request timed out` ;
77
+
78
+ if ( error . code === AxiosError . ECONNABORTED ) {
79
+ errorMessage = `Request timed out` ;
80
+ } else {
81
+ errorMessage = `Error code: ${ error . code ?? "n/a" } / Error stack: ${
82
+ error . stack ?? "n/a"
83
+ } `;
84
+ }
77
85
}
78
86
} else if ( error instanceof Error ) {
79
87
errorMessage = `${ ( error as Error ) . message } ` ;
You can’t perform that action at this time.
0 commit comments