Skip to content

Commit f63ff10

Browse files
committed
Proper multi-output callback exceptions.
1 parent eb8e1c5 commit f63ff10

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

Diff for: dash/dash.py

+14-4
Original file line numberDiff line numberDiff line change
@@ -857,13 +857,23 @@ def add_context(*args, **kwargs):
857857
output_value = func(*args, **kwargs)
858858
if multi:
859859
if not isinstance(output_value, (list, tuple)):
860-
raise Exception('Invalid output value')
860+
raise exceptions.InvalidCallbackReturnValue(
861+
'The callback {} is a multi-output.\n'
862+
'Expected the output type to be a list'
863+
' or tuple but got {}.'.format(
864+
callback_id, repr(output_value)
865+
)
866+
)
861867

862868
if not len(output_value) == len(output):
863-
raise Exception(
864-
'Invalid number of output values.'
869+
raise exceptions.InvalidCallbackReturnValue(
870+
'Invalid number of output values for {}.\n'
865871
' Expected {} got {}'.format(
866-
len(output), len(output_value)))
872+
callback_id,
873+
len(output),
874+
len(output_value)
875+
)
876+
)
867877

868878
props = collections.defaultdict(dict)
869879
for i, out in enumerate(output):

0 commit comments

Comments
 (0)