File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -66,22 +66,26 @@ class Logger {
6666 }
6767
6868 _getErrorDetails ( error ) {
69- const details = {
69+ const baseDetails = {
7070 error_name : error . name ,
7171 error_stack : this . _shortenStackTrace ( error . stack ) ,
7272 error_message : error . message ,
7373 error_data : this . _shortenData ( error . data )
7474 } ;
7575
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+ }
8378
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+ } ;
8589 }
8690}
8791
You can’t perform that action at this time.
0 commit comments