Merge ~brad-marshall/charm-grafana/+git/grafana-charm-dashboard-action:action-fix-detail into ~prometheus-charmers/charm-grafana:master
Proposed by
Brad Marshall
Status: | Merged |
---|---|
Merged at revision: | 92a68424cb2af5e38bb3add8faa6b2df37cd2b18 |
Proposed branch: | ~brad-marshall/charm-grafana/+git/grafana-charm-dashboard-action:action-fix-detail |
Merge into: | ~prometheus-charmers/charm-grafana:master |
Diff against target: |
40 lines (+10/-3) 1 file modified
actions/import-dashboard (+10/-3) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stuart Bishop (community) | Approve | ||
Review via email: mp+327194@code.launchpad.net |
Description of the change
Add extra detail to final json decode stanza, fix it to use except rather than else.
To post a comment you must log in.
Almost every use of a bare except: is a bug in modern Python, and you should use except Exception: here.
I tend to do the following, preserving traceback and ensuring it ends up in the logs via print. It makes diagnosing failures easier:
except Exception:
hookenv. action_ fail('Unhandled exception') format_ exc()
hookenv. action_ set(dict( traceback= tb))
hookenv. log('Unhandled exception in action {}'.format(action))
tb = traceback.
print(tb)