Skip to content

Commit ab212a3

Browse files
authored
Merge pull request #1448 from almarklein/forgot-decorator
Improve error message
2 parents d711f61 + 646f4f7 commit ab212a3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ This project adheres to [Semantic Versioning](https://semver.org/).
88
### Fixed
99
- [#1434](https://github.com/plotly/dash/pull/1434) Fix [#1432](https://github.com/plotly/dash/issues/1432) for Julia to import non-core component packages without possible errors.
1010

11+
### Changed
12+
- [#1448](https://github.com/plotly/dash/pull/1448) Provide a hint in the callback error when the user forgot to make `app.callback(...)` a decorator.
13+
1114
## [1.16.3] - 2020-10-07
1215
### Fixed
1316
- [#1426](https://github.com/plotly/dash/pull/1426) Fix a regression caused by `flask-compress==1.6.0` causing performance degradation on server requests

dash/dash.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,11 @@ def dispatch(self):
10681068

10691069
args = inputs_to_vals(inputs + state)
10701070

1071-
func = self.callback_map[output]["callback"]
1071+
try:
1072+
func = self.callback_map[output]["callback"]
1073+
except KeyError:
1074+
msg = "Callback function not found for output '{}', perhaps you forgot to prepend the '@'?"
1075+
raise KeyError(msg.format(output))
10721076
response.set_data(func(*args, outputs_list=outputs_list))
10731077
return response
10741078

0 commit comments

Comments
 (0)