File tree 1 file changed +13
-9
lines changed 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -66,22 +66,26 @@ class Logger {
66
66
}
67
67
68
68
_getErrorDetails ( error ) {
69
- const details = {
69
+ const baseDetails = {
70
70
error_name : error . name ,
71
71
error_stack : this . _shortenStackTrace ( error . stack ) ,
72
72
error_message : error . message ,
73
73
error_data : this . _shortenData ( error . data )
74
74
} ;
75
75
76
- if ( error . isAxiosError ) {
77
- details . request_method = error . config . method ;
78
- details . request_url = error . config . url ;
79
- details . response_status = error . response . status ;
80
- details . response_status_text = error . response . statusText ;
81
- details . response_data = this . _shortenData ( error . response . data ) ;
82
- }
76
+ return Object . assign ( baseDetails , this . _getAxiosErrorDetails ( error ) ) ;
77
+ }
83
78
84
- return details ;
79
+ _getAxiosErrorDetails ( error ) {
80
+ if ( ! error . isAxiosError ) return { } ;
81
+
82
+ return {
83
+ request_method : error . config . method ,
84
+ request_url : error . config . url ,
85
+ response_status : error . response ? error . response . status : undefined ,
86
+ response_status_text : error . response ? error . response . statusText : undefined ,
87
+ response_data : error . response ? this . _shortenData ( error . response . data ) : undefined
88
+ } ;
85
89
}
86
90
}
87
91
You can’t perform that action at this time.
0 commit comments