Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

Try/Catch blocks in checks only work with generic Exceptions. Cannot catch specific exceptions #354

Open
rajatparida86 opened this issue Aug 16, 2018 · 1 comment
Labels
bug user-reported issues that take more than one hour to resolve

Comments

@rajatparida86
Copy link

No description provided.

@rajatparida86 rajatparida86 changed the title Try/Catch blocks only work with generic Exceptions. Cannot write catch Try/Catch blocks only work with generic Exceptions. Cannot catch specific exceptions Aug 16, 2018
@rajatparida86 rajatparida86 changed the title Try/Catch blocks only work with generic Exceptions. Cannot catch specific exceptions Try/Catch blocks in checks only work with generic Exceptions. Cannot catch specific exceptions Aug 16, 2018
@rajatparida86
Copy link
Author

When we try the following in a check:
try:
success_value = meters[key]["m5_rate"]
except KeyError
pass

Error that we get:
"Traceback (most recent call last):\n File "/usr/local/lib/python2.7/dist-packages/zmon_worker-0.1-py2.7.egg/zmon_worker_monitor/zmon_worker/tasks/main.py", line 1248, in _get_check_result_internal\n result = safe_eval(cmd, eval_source='', **ctx)\n File "/usr/local/lib/python2.7/dist-packages/zmon_worker-0.1-py2.7.egg/zmon_worker_monitor/zmon_worker/common/eval.py", line 187, in safe_eval\n return c() # if a function will return another callable, we will not call it\n File "", line 14, in check\nNameError: global name 'KeyError' is not defined\n"

mohabusama added a commit that referenced this issue Apr 9, 2019
@pitr pitr added the bug user-reported issues that take more than one hour to resolve label May 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug user-reported issues that take more than one hour to resolve
Projects
None yet
Development

No branches or pull requests

2 participants