Python flask.g.sentry_event_id() Examples

The following are 4 code examples of flask.g.sentry_event_id(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module flask.g , or try the search function .
Example #1
Source File: errors.py    From invenio-app-ils with MIT License 6 votes vote down vote up
def get_body(self, environ=None):
        """Get the request body."""
        body = dict(
            status=self.code,
            message=self.get_description(environ),
            error_module="ILS",
            error_class=self.name,
        )

        errors = self.get_errors()
        if self.errors:
            body["errors"] = errors

        if self.code and (self.code >= 500) and hasattr(g, "sentry_event_id"):
            body["error_id"] = str(g.sentry_event_id)

        return json.dumps(body) 
Example #2
Source File: app.py    From Titan with GNU Affero General Public License v3.0 6 votes vote down vote up
def context_processor():
    return {
        "random": random,
        "application_settings": get_application_settings(),
        "devs": get_administrators_list(),
        "sentry_js_dsn": config.get("sentry-js-dsn", None),
        "constants": constants,
        "af_mode_enabled": datetime.datetime.now().date() == datetime.date(datetime.datetime.now().year, 4, 1),
        "dbl_voted": session.get("unauthenticated", True) == False and bool(redis_store.get("DiscordBotsOrgVoted/" + str(session.get("user_id", -1)))),
        "app_start_stamp": app_start_stamp
    }

# @app.errorhandler(500)
# def internal_server_error(error):
#     return render_template('500.html.j2',
#         event_id=g.sentry_event_id,
#         public_dsn=sentry.client.get_public_dsn('https')
#     ), 500 
Example #3
Source File: web_helpers.py    From everyclass-server with Mozilla Public License 2.0 5 votes vote down vote up
def _error_page(message: str, sentry_capture: bool = False, log: str = None):
    """return a error page with a message. if sentry is available, tell user that they can report the problem."""
    sentry_param = {}
    if sentry_capture and plugin_available("sentry"):
        sentry.captureException()
        sentry_param.update({"event_id": g.sentry_event_id,
                             "public_dsn": sentry.client.get_public_dsn('https')
                             })
    if log:
        logger.info(log)
    return render_template('common/error.html', message=message, **sentry_param) 
Example #4
Source File: routes.py    From profbit with MIT License 5 votes vote down vote up
def internal_server_error(e, context=None):
    if context is None:
        context = {
            'error_title': 500,
            'page_title': '500 Internal Server Error',
        }
    if sentry:
        context['event_id'] = g.sentry_event_id
    return render_template('error.html', **context), 500