diff options
author | Lars Wirzenius <lwirzenius@wikimedia.org> | 2019-07-04 17:08:51 +0300 |
---|---|---|
committer | Lars Wirzenius <lwirzenius@wikimedia.org> | 2019-07-04 17:08:51 +0300 |
commit | 12faa927a76281af8f7361db64265bdec91dbc36 (patch) | |
tree | 5a2e5170f272c70a38cf02cb15b363ec3b803aa1 /api.py | |
parent | 6189206577786426b97fcbb7f84f1a06caf0c9cf (diff) | |
download | wmf-ci-arch-12faa927a76281af8f7361db64265bdec91dbc36.tar.gz |
Add: catch exceptions inside callback too
Diffstat (limited to 'api.py')
-rwxr-xr-x | api.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -137,7 +137,11 @@ class API: if self._checker.access_is_allowed(r.headers, required_scopes): logging.info('Access is allowed: %s %s', r.method, r.path) - ret = func(**kwargs) + try: + ret = func(**kwargs) + except Exception as e: + logging.warning('Caught exception: %s', str(e)) + return bottle.httpError(500) logging.info('Result: %r', ret) return ret |