File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -350,11 +350,27 @@ def handle_none(rv):
350
350
351
351
# Execute the module, within the application context
352
352
with _app .app_context ():
353
- spec .loader .exec_module (source_module )
353
+ try :
354
+ spec .loader .exec_module (source_module )
355
+ function = _function_registry .get_user_function (source , source_module , target )
356
+ except Exception as e :
357
+ if werkzeug .serving .is_running_from_reloader ():
358
+ # When reloading, print out the error immediately, but raise
359
+ # it later so the debugger or server can handle it.
360
+ import traceback
361
+ traceback .print_exc ()
362
+ err = e
363
+
364
+ def function (* _args , ** _kwargs ):
365
+ raise err from None
366
+
367
+ else :
368
+ # When not reloading, raise the error immediately so the
369
+ # command fails.
370
+ raise e from None
354
371
355
372
# Get the configured function signature type
356
373
signature_type = _function_registry .get_func_signature_type (target , signature_type )
357
- function = _function_registry .get_user_function (source , source_module , target )
358
374
359
375
_configure_app (_app , function , signature_type )
360
376
You can’t perform that action at this time.
0 commit comments