File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -463,12 +463,17 @@ def add_context(*args, **kwargs):
463
463
f"An error occurred inside a long callback: { error ['msg' ]} \n { error ['tb' ]} "
464
464
)
465
465
if error_handler :
466
- error_handler (exc )
467
- output_value = NoUpdate ()
466
+ output_value = error_handler (exc )
467
+
468
+ if output_value is None :
469
+ output_value = NoUpdate ()
468
470
# set_props from the error handler uses the original ctx
469
471
# instead of manager.get_updated_props since it runs in the
470
472
# request process.
471
- has_update = _set_side_update (callback_ctx , response )
473
+ has_update = (
474
+ _set_side_update (callback_ctx , response )
475
+ or output_value is not None
476
+ )
472
477
else :
473
478
raise exc
474
479
@@ -495,11 +500,14 @@ def add_context(*args, **kwargs):
495
500
raise err
496
501
except Exception as err : # pylint: disable=broad-exception-caught
497
502
if error_handler :
498
- error_handler (err )
499
- if not multi :
500
- output_value = NoUpdate ()
501
- else :
502
- output_value = [NoUpdate for _ in output_spec ]
503
+ output_value = error_handler (err )
504
+
505
+ # If the error returns nothing, automatically puts NoUpdate for response.
506
+ if output_value is None :
507
+ if not multi :
508
+ output_value = NoUpdate ()
509
+ else :
510
+ output_value = [NoUpdate for _ in output_spec ]
503
511
else :
504
512
raise err
505
513
You can’t perform that action at this time.
0 commit comments