File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -244,22 +244,26 @@ export function array<T, C extends Context = Context>(
244
244
}
245
245
246
246
function withErrorAsWarning < C extends Context , I , O > (
247
- f : CtxFunc < C , I , O >
248
- ) : CtxFunc < C , I , O > {
247
+ f : CtxFunc < C , I , Maybe < O > > ,
248
+ valueIfError : O
249
+ ) : CtxFunc < C , I , Maybe < O > > {
249
250
return ( i , ctx ) => {
250
251
const prev = ctx . errorAsWarning
251
252
ctx . errorAsWarning = true
252
253
const result = f ( i , ctx )
253
254
ctx . errorAsWarning = prev
254
- return result
255
+ return result . value === undefined ? Maybe . some ( valueIfError ) : result
255
256
}
256
257
}
257
258
258
259
export const commonDebugFields : StructFields < CommonDebug > = {
259
- debugKey : field ( 'debug_key' , withDefault ( withErrorAsWarning ( uint64 ) , null ) ) ,
260
+ debugKey : field (
261
+ 'debug_key' ,
262
+ withDefault ( withErrorAsWarning ( uint64 , null ) , null )
263
+ ) ,
260
264
debugReporting : field (
261
265
'debug_reporting' ,
262
- withDefault ( withErrorAsWarning ( bool ) , false )
266
+ withDefault ( withErrorAsWarning ( bool , false ) , false )
263
267
) ,
264
268
}
265
269
You can’t perform that action at this time.
0 commit comments