Commit 92653101 authored by kaiyou's avatar kaiyou

Push the error stack when normalizing exceptions

parent 1d10e021
Pipeline #200 passed with stage
in 1 minute and 7 seconds
......@@ -35,7 +35,7 @@ def normalize(context, result, success="message", error="message", up="up"):
for further use.
"""
if isinstance(result, Exception):
result = {up: False, error: str(result)}
result = {up: False, error: str(result), stack: result.stack}
elif not type(result) is dict:
result = {up: True, success: result}
return context, result
......@@ -82,3 +82,5 @@ def merge_result(context, result):
""" Merge the result of a check back into the context
"""
return dict(context, **result), result
import celery
import traceback
from amonit import util, config, state
......@@ -60,6 +61,7 @@ def check_run(checkid, function, context, args):
try:
result = util.resolve(function)(context, **args)
except Exception as error:
error.stack = traceback.format_exc()
result = error
context, result = scheduler.hook("postcheck", context, result)
scheduler.state[checkid] = context
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment