Commit 4f86a09 1 parent a1eb8dd commit 4f86a09 Copy full SHA for 4f86a09
File tree 2 files changed +14
-6
lines changed
packages/midway-component-fetch/src/lib
2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -111,17 +111,25 @@ export class FetchComponent {
111
111
return ret
112
112
}
113
113
catch ( ex ) {
114
- if ( typeof config . processEx === 'function' ) {
114
+ if ( config . enableDefaultCallbacks ) {
115
+ if ( typeof defaultfetchConfigCallbacks . processEx === 'function' ) {
116
+ return defaultfetchConfigCallbacks . processEx ( {
117
+ id,
118
+ ctx : this . ctx ,
119
+ opts,
120
+ exception : ex as Error ,
121
+ } )
122
+ }
123
+ }
124
+ else if ( typeof config . processEx === 'function' ) {
115
125
return config . processEx ( {
116
126
id,
117
127
ctx : this . ctx ,
118
128
opts,
119
129
exception : ex as Error ,
120
130
} )
121
131
}
122
- else {
123
- throw ex
124
- }
132
+ throw ex
125
133
}
126
134
}
127
135
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ const afterResponse: FetchComponentConfig['afterResponse'] = async (options) =>
114
114
fetchRequestSpanMap . delete ( id )
115
115
}
116
116
117
- export const handleEx : FetchComponentConfig [ 'processEx' ] = ( options ) => {
117
+ export const processEx : FetchComponentConfig [ 'processEx' ] = ( options ) => {
118
118
const { id, ctx, exception } = options
119
119
const time = genISO8601String ( )
120
120
const mem = humanMemoryUsage ( )
@@ -160,7 +160,7 @@ export const defaultfetchConfigCallbacks = {
160
160
// genRequestHeaders,
161
161
beforeRequest,
162
162
afterResponse,
163
- handleEx ,
163
+ processEx ,
164
164
}
165
165
166
166
export function retrieveHeadersItem (
You can’t perform that action at this time.
0 commit comments