Reporting to Sentry all captured exceptions and enabling multiple environments
This commit is contained in:
parent
e82532aad8
commit
fcb772c900
|
@ -15,7 +15,8 @@ TEST_UID = environ.get('TEST_UID', default="dhf8r")
|
|||
ADMIN_UIDS = re.split(r',\s*', environ.get('ADMIN_UIDS', default="dhf8r,ajl2j,cah3us,cl3wf"))
|
||||
|
||||
# Sentry flag
|
||||
ENABLE_SENTRY = environ.get('ENABLE_SENTRY', default="false") == "true"
|
||||
ENABLE_SENTRY = environ.get('ENABLE_SENTRY', default="false") == "true" # To be removed soon
|
||||
SENTRY_ENVIRONMENT = environ.get('SENTRY_ENVIRONMENT', None)
|
||||
|
||||
# Add trailing slash to base path
|
||||
APPLICATION_ROOT = re.sub(r'//', '/', '/%s/' % environ.get('APPLICATION_ROOT', default="/").strip('/'))
|
||||
|
|
|
@ -52,8 +52,9 @@ origins_re = [r"^https?:\/\/%s(.*)" % o.replace('.', '\.') for o in app.config['
|
|||
cors = CORS(connexion_app.app, origins=origins_re)
|
||||
|
||||
# Sentry error handling
|
||||
if app.config['ENABLE_SENTRY']:
|
||||
if app.config['SENTRY_ENVIRONMENT']:
|
||||
sentry_sdk.init(
|
||||
environment=app.config['SENTRY_ENVIRONMENT'],
|
||||
dsn="https://25342ca4e2d443c6a5c49707d68e9f40@o401361.ingest.sentry.io/5260915",
|
||||
integrations=[FlaskIntegration()]
|
||||
)
|
||||
|
|
|
@ -25,6 +25,7 @@ class ApiError(Exception):
|
|||
instance.task_name = task.task_spec.description or ""
|
||||
instance.file_name = task.workflow.spec.file or ""
|
||||
instance.task_data = task.data
|
||||
app.logger.error(message, exc_info=True)
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
|
@ -35,6 +36,7 @@ class ApiError(Exception):
|
|||
instance.task_name = task_spec.description or ""
|
||||
if task_spec._wf_spec:
|
||||
instance.file_name = task_spec._wf_spec.file
|
||||
app.logger.error(message, exc_info=True)
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -376,7 +376,7 @@ class WorkflowService(object):
|
|||
try:
|
||||
task.title = spiff_task.workflow.script_engine.evaluate_expression(spiff_task, task.properties['display_name'])
|
||||
except Exception as e:
|
||||
app.logger.info("Failed to set title on task due to type error." + str(e))
|
||||
app.logger.error("Failed to set title on task due to type error." + str(e), exc_info=True)
|
||||
elif task.title and ' ' in task.title:
|
||||
task.title = task.title.partition(' ')[2]
|
||||
return task
|
||||
|
|
Loading…
Reference in New Issue