{"componentChunkName":"component---src-templates-doc-tsx","path":"/product/sentry-basics/guides/integrate-backend/capturing-errors/","result":{"data":{"file":{"id":"2522ac3a-9092-5c98-9a30-afd011ed2d5e","relativePath":"product/sentry-basics/guides/integrate-backend/capturing-errors.mdx","sourceInstanceName":"docs","childMarkdownRemark":null,"childMdx":{"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"Capturing Errors\",\n  \"redirect_from\": [\"/guides/integrate-backend/capturing-errors/\"]\n};\n\nvar makeShortcode = function makeShortcode(name) {\n  return function MDXDefaultShortcode(props) {\n    console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n    return mdx(\"div\", props);\n  };\n};\n\nvar CodeTabs = makeShortcode(\"CodeTabs\");\nvar CodeBlock = makeShortcode(\"CodeBlock\");\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, [\"components\"]);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"Once initialized in your code, the Sentry SDK will capture various types of events and notify you about them in real-time, depending on the alert rules you've configured. With the Django app already running on your \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"http://localhost:8000/\"\n  }), \"localhost\"), \", let's try them out.\"), mdx(\"blockquote\", null, mdx(\"p\", {\n    parentName: \"blockquote\"\n  }, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Note:\"), \" If you're using your own source code, follow \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"/platforms/python/guides/django/\"\n  }), \"Capturing your first event\"), \" to introduce an error into your app.\")), mdx(\"h2\", {\n    \"id\": \"unhandled-errors\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h2\"\n  }, {\n    \"href\": \"#unhandled-errors\",\n    \"aria-label\": \"unhandled errors permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Unhandled Errors\"), mdx(\"p\", null, \"The Sentry SDK will automatically capture and report any Unhandled Error that happens in your application runtime without any additional configuration or explicit handling. Generally, Unhandled Errors are errors the aren't caught by any except (or try/catch) clause.\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"In your browser, launch the local Django app in the following endpoint to trigger an unhandled error: \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"http://localhost:8000/unhandled\"), \".\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"If you've set up an alert rule, you should be notified about the error. Otherwise, open the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Issues\"), \" view in your Sentry account.\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Notice the unhandled exception appears in your \", mdx(\"em\", {\n    parentName: \"p\"\n  }, \"Issues Stream\"), \".\"), mdx(\"p\", {\n    parentName: \"li\"\n  }, mdx(\"span\", _extends({\n    parentName: \"p\"\n  }, {\n    \"className\": \"gatsby-resp-image-wrapper\",\n    \"style\": {\n      \"position\": \"relative\",\n      \"display\": \"block\",\n      \"marginLeft\": \"auto\",\n      \"marginRight\": \"auto\",\n      \"maxWidth\": \"1200px\"\n    }\n  }), \"\\n      \", mdx(\"a\", _extends({\n    parentName: \"span\"\n  }, {\n    \"className\": \"gatsby-resp-image-link\",\n    \"href\": \"/static/8bcaa91c69ec186bb822ef2733ba4df2/60c1e/unhandled_issue.png\",\n    \"style\": {\n      \"display\": \"block\"\n    },\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }), \"\\n    \", mdx(\"span\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-background-image\",\n    \"style\": {\n      \"paddingBottom\": \"37.99999999999999%\",\n      \"position\": \"relative\",\n      \"bottom\": \"0\",\n      \"left\": \"0\",\n      \"backgroundImage\": \"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAIAAAB2/0i6AAAACXBIWXMAAAsSAAALEgHS3X78AAABKUlEQVQY052PW0sDMRCF8ycEr++Voq1CH0StVcSHXVrFUtGi4B30yX9dC3Wzm51cJ8k6tSD7KMLH5OQkM5xhlwf3p63h0/CD5yIvSmNdrCr03odIWhuntA0xzs0QyKGrQx+qSIWdtUa7ayd3/fdMyM8ZB2MVekIalwvJi1JqO/sqMi6UdQIUSO18oAEaPUs6N+3V49v+WwGK3sEiGJQOhTR5qUptMgE0lwvIQZEgwDguZC4V6zXP2+u9cfoqy3Iy4dNpBqAomLU4jxcrxEAH4TCQ43DuU3hKxHpbF9sr3XH6Iq2bZZRUS21AGdBWWbQ0ZYEProZxaCyybnOws3F0nTxr2iRWVH9RBP7UhahBC9MHtt9Imst7V8ljve2PsMPNpLHUGaUP/2j+BgKlnwypzRo7AAAAAElFTkSuQmCC')\",\n      \"backgroundSize\": \"cover\",\n      \"display\": \"block\"\n    }\n  })), \"\\n  \", mdx(\"img\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-image\",\n    \"alt\": \"Unhandled Issue\",\n    \"title\": \"Unhandled Issue\",\n    \"src\": \"/static/8bcaa91c69ec186bb822ef2733ba4df2/c1b63/unhandled_issue.png\",\n    \"srcSet\": [\"/static/8bcaa91c69ec186bb822ef2733ba4df2/5a46d/unhandled_issue.png 300w\", \"/static/8bcaa91c69ec186bb822ef2733ba4df2/0a47e/unhandled_issue.png 600w\", \"/static/8bcaa91c69ec186bb822ef2733ba4df2/c1b63/unhandled_issue.png 1200w\", \"/static/8bcaa91c69ec186bb822ef2733ba4df2/d61c2/unhandled_issue.png 1800w\", \"/static/8bcaa91c69ec186bb822ef2733ba4df2/60c1e/unhandled_issue.png 1866w\"],\n    \"sizes\": \"(max-width: 1200px) 100vw, 1200px\",\n    \"style\": {\n      \"width\": \"100%\",\n      \"height\": \"100%\",\n      \"margin\": \"0\",\n      \"verticalAlign\": \"middle\",\n      \"position\": \"absolute\",\n      \"top\": \"0\",\n      \"left\": \"0\"\n    },\n    \"loading\": \"lazy\"\n  })), \"\\n  \"), \"\\n    \"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Click on the issue, to open the issue details page.\"), mdx(\"p\", {\n    parentName: \"li\"\n  }, mdx(\"span\", _extends({\n    parentName: \"p\"\n  }, {\n    \"className\": \"gatsby-resp-image-wrapper\",\n    \"style\": {\n      \"position\": \"relative\",\n      \"display\": \"block\",\n      \"marginLeft\": \"auto\",\n      \"marginRight\": \"auto\",\n      \"maxWidth\": \"1200px\"\n    }\n  }), \"\\n      \", mdx(\"a\", _extends({\n    parentName: \"span\"\n  }, {\n    \"className\": \"gatsby-resp-image-link\",\n    \"href\": \"/static/a36bbf1ec94689dfe99833b72715afa9/460fa/error_with_all_tags.png\",\n    \"style\": {\n      \"display\": \"block\"\n    },\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }), \"\\n    \", mdx(\"span\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-background-image\",\n    \"style\": {\n      \"paddingBottom\": \"65.66666666666667%\",\n      \"position\": \"relative\",\n      \"bottom\": \"0\",\n      \"left\": \"0\",\n      \"backgroundImage\": \"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAIAAAAmMtkJAAAACXBIWXMAAAsSAAALEgHS3X78AAAB7klEQVQoz1VSi27bMAz0///agKHLCgzL2qSPZI5tSZSoJ/XyaLcLNuFMyCRI3h00XK6X4/n1JkBZn1pPre1xQ6wt1kq9X6Z5FGoBY1M2kUxI2keFflCIM2ihUaED6xl8kehmMBjJlxJK1T5s91y3iftQTobahttipPbaJsAINmiMxkX0jGBjsiEZF3zKmbnU5ikHyjGXVCpxs0WvIIAhQJp1kVh7X++nc0+k1vra11KKZuZocy6tNa4OIfMSdNHlnnMvtMX/wV1r2WIpUiohVa31Y/RwtYfzePg+Hn8uT9c43vIkVxCrYshVqRWWJl/w/Y0uvnqQ2jp35zVoO0FYdEHbHAMrAmnXPQPIQDJYLOf5t7QaApvVPhX1PhzPD/PvV6Ndq42FxUDzJGreiD3/er9eb2jwrp/V9v2wC5UNy632fQ4XPyfyt/5j2keWy61lNuGvn5wZvA+gnbLMlYyxFhNisjaMVl6smpLRzUAxZa2ZstsFp5TGSUowA/J7kHpWKKQdlX6E46M4P5inL/DtIE5f9csPfzql17imWqrznptLbS7kRGVwPgjuNFHoMAGe9Pxs5DvOwngp0ySTgEK0UWXOMUa+EOV5UaBxsNYtytwgLZpNj7PKN0GT5DcTiMhTDVTarrPwZud3t7bNkeofXV3rCrR9xhYAAAAASUVORK5CYII=')\",\n      \"backgroundSize\": \"cover\",\n      \"display\": \"block\"\n    }\n  })), \"\\n  \", mdx(\"img\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-image\",\n    \"alt\": \"Issue Details Page\",\n    \"title\": \"Issue Details Page\",\n    \"src\": \"/static/a36bbf1ec94689dfe99833b72715afa9/c1b63/error_with_all_tags.png\",\n    \"srcSet\": [\"/static/a36bbf1ec94689dfe99833b72715afa9/5a46d/error_with_all_tags.png 300w\", \"/static/a36bbf1ec94689dfe99833b72715afa9/0a47e/error_with_all_tags.png 600w\", \"/static/a36bbf1ec94689dfe99833b72715afa9/c1b63/error_with_all_tags.png 1200w\", \"/static/a36bbf1ec94689dfe99833b72715afa9/d61c2/error_with_all_tags.png 1800w\", \"/static/a36bbf1ec94689dfe99833b72715afa9/460fa/error_with_all_tags.png 1910w\"],\n    \"sizes\": \"(max-width: 1200px) 100vw, 1200px\",\n    \"style\": {\n      \"width\": \"100%\",\n      \"height\": \"100%\",\n      \"margin\": \"0\",\n      \"verticalAlign\": \"middle\",\n      \"position\": \"absolute\",\n      \"top\": \"0\",\n      \"left\": \"0\"\n    },\n    \"loading\": \"lazy\"\n  })), \"\\n  \"), \"\\n    \"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Notice that the event:\"), mdx(\"ul\", {\n    parentName: \"li\"\n  }, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Is tagged with the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"environment\"), \" and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"release\"), \" options we've set in the previous tutorial and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"handled:no\"), \" - marking this event as an unhandled error.\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Contains a \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"Suspect Commit\"), \" enabled by the commit tracking feature we enabled previously.\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Contains the custom breadcrumb we added through the SDK.\"), mdx(\"p\", {\n    parentName: \"li\"\n  }, mdx(\"span\", _extends({\n    parentName: \"p\"\n  }, {\n    \"className\": \"gatsby-resp-image-wrapper\",\n    \"style\": {\n      \"position\": \"relative\",\n      \"display\": \"block\",\n      \"marginLeft\": \"auto\",\n      \"marginRight\": \"auto\",\n      \"maxWidth\": \"1200px\"\n    }\n  }), \"\\n      \", mdx(\"a\", _extends({\n    parentName: \"span\"\n  }, {\n    \"className\": \"gatsby-resp-image-link\",\n    \"href\": \"/static/d6770433d8331e6f9aea049155b7d89e/913a1/unhandled_issue_breadcrumbs.png\",\n    \"style\": {\n      \"display\": \"block\"\n    },\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }), \"\\n    \", mdx(\"span\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-background-image\",\n    \"style\": {\n      \"paddingBottom\": \"25%\",\n      \"position\": \"relative\",\n      \"bottom\": \"0\",\n      \"left\": \"0\",\n      \"backgroundImage\": \"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAFCAIAAADKYVtkAAAACXBIWXMAAAsSAAALEgHS3X78AAAAzklEQVQY01WOzUpEMQxG7/u/jBtx4SPIwODCjaLMiG4692fapEmapK0dLoJ+OYRwIPBNhMSZB72N9JHjYb6/Oz0+fM0BtRTKwizute7Utu9hJiYuY0hUza262/vrejyEl+cFIquqiBZRU9upertvxnzKmTDzdUvbGsd7jJggtWa9V3Mf5i/DfAaKWSFhKToxoG8bLGsMlybCMeGypcsK8+pEXaWXX4S76+npDb+DAHgpk2RqiBlQiJobXCMBjjIZwKSMkv9w7+cPX2ZidrMftTMfaMBrBKIAAAAASUVORK5CYII=')\",\n      \"backgroundSize\": \"cover\",\n      \"display\": \"block\"\n    }\n  })), \"\\n  \", mdx(\"img\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-image\",\n    \"alt\": \"Unhandled Breadcrumbs\",\n    \"title\": \"Unhandled Breadcrumbs\",\n    \"src\": \"/static/d6770433d8331e6f9aea049155b7d89e/c1b63/unhandled_issue_breadcrumbs.png\",\n    \"srcSet\": [\"/static/d6770433d8331e6f9aea049155b7d89e/5a46d/unhandled_issue_breadcrumbs.png 300w\", \"/static/d6770433d8331e6f9aea049155b7d89e/0a47e/unhandled_issue_breadcrumbs.png 600w\", \"/static/d6770433d8331e6f9aea049155b7d89e/c1b63/unhandled_issue_breadcrumbs.png 1200w\", \"/static/d6770433d8331e6f9aea049155b7d89e/913a1/unhandled_issue_breadcrumbs.png 1476w\"],\n    \"sizes\": \"(max-width: 1200px) 100vw, 1200px\",\n    \"style\": {\n      \"width\": \"100%\",\n      \"height\": \"100%\",\n      \"margin\": \"0\",\n      \"verticalAlign\": \"middle\",\n      \"position\": \"absolute\",\n      \"top\": \"0\",\n      \"left\": \"0\"\n    },\n    \"loading\": \"lazy\"\n  })), \"\\n  \"), \"\\n    \")))))), mdx(\"h2\", {\n    \"id\": \"handled-errors\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h2\"\n  }, {\n    \"href\": \"#handled-errors\",\n    \"aria-label\": \"handled errors permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Handled Errors\"), mdx(\"p\", null, \"The Sentry SDK contains several methods that you can utilize to \", mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"explicitly\"), \" report errors, events, and custom messages in except clauses, critical areas of your code, etc.\"), mdx(\"h3\", {\n    \"id\": \"capture-exception\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h3\"\n  }, {\n    \"href\": \"#capture-exception\",\n    \"aria-label\": \"capture exception permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Capture Exception\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Open the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"views.py\"), \" file. Notice that we import \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"sentry_sdk\"), \" lib which contains the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"capture_exception\"), \" method\"), mdx(\"div\", _extends({\n    parentName: \"li\"\n  }, {\n    \"className\": \"code-tabs-wrapper\"\n  }), mdx(CodeTabs, {\n    mdxType: \"CodeTabs\"\n  }, mdx(CodeBlock, {\n    language: \"python\",\n    title: \"\",\n    filename: \"\",\n    mdxType: \"CodeBlock\"\n  }, mdx(\"div\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"python\"\n  }), mdx(\"pre\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"language-python\"\n  }), mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-python\"\n  }), \"   \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token keyword\"\n  }), \"import\"), \" sentry_sdk\"))))))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"The method is utilized to capture the exception handled by the except clause in \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"HandledErrorView\"), \".\"), mdx(\"p\", {\n    parentName: \"li\"\n  }, mdx(\"span\", _extends({\n    parentName: \"p\"\n  }, {\n    \"className\": \"gatsby-resp-image-wrapper\",\n    \"style\": {\n      \"position\": \"relative\",\n      \"display\": \"block\",\n      \"marginLeft\": \"auto\",\n      \"marginRight\": \"auto\",\n      \"maxWidth\": \"694px\"\n    }\n  }), \"\\n      \", mdx(\"a\", _extends({\n    parentName: \"span\"\n  }, {\n    \"className\": \"gatsby-resp-image-link\",\n    \"href\": \"/static/3c7cc08cd5e3859ee7ff0ccd1bf02d03/31198/capture_exception.png\",\n    \"style\": {\n      \"display\": \"block\"\n    },\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }), \"\\n    \", mdx(\"span\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-background-image\",\n    \"style\": {\n      \"paddingBottom\": \"34%\",\n      \"position\": \"relative\",\n      \"bottom\": \"0\",\n      \"left\": \"0\",\n      \"backgroundImage\": \"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAIAAACHqfpvAAAACXBIWXMAAAsSAAALEgHS3X78AAABMElEQVQY02XQ7W6CMBQGYK/DiUChPaeFAkUYBcEqoDDddHH7sfu/kjG3RJMlb07OnyfnY4aNhq1JalqN86KzytMia6zMWPnergYsx6diP9+MIo4FoIOcPGbGJaDO+MuhGq3m6L33bls7eU4++/m1XRw6kRY8Up4IKHL3H0bCOWESS8G6MFqtUAoScD8N3JgvhfCA+z51YJLC+w2/5Yb/OlciVZRVKSYxpqqAOPIlBEBCJCrhghMAG8GZKmU2A+eOgRMN2PvhJSr00Mt9q88nMXRFkhtd7s6DzBNQElIZZnH+HKs0mNQdK2QFg8tue7i+Na/D8evDXE7h0LN1wdYamhJNzUyTtJvtrtRaicCfTdOnmye8AmZoULqU5QpM7VU62ZQqQcaWHF2cXv2ztv249jdcQUw0uJIx0QAAAABJRU5ErkJggg==')\",\n      \"backgroundSize\": \"cover\",\n      \"display\": \"block\"\n    }\n  })), \"\\n  \", mdx(\"img\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-image\",\n    \"alt\": \"Import and Configure SDK\",\n    \"title\": \"Import and Configure SDK\",\n    \"src\": \"/static/3c7cc08cd5e3859ee7ff0ccd1bf02d03/31198/capture_exception.png\",\n    \"srcSet\": [\"/static/3c7cc08cd5e3859ee7ff0ccd1bf02d03/5a46d/capture_exception.png 300w\", \"/static/3c7cc08cd5e3859ee7ff0ccd1bf02d03/0a47e/capture_exception.png 600w\", \"/static/3c7cc08cd5e3859ee7ff0ccd1bf02d03/31198/capture_exception.png 694w\"],\n    \"sizes\": \"(max-width: 694px) 100vw, 694px\",\n    \"style\": {\n      \"width\": \"100%\",\n      \"height\": \"100%\",\n      \"margin\": \"0\",\n      \"verticalAlign\": \"middle\",\n      \"position\": \"absolute\",\n      \"top\": \"0\",\n      \"left\": \"0\"\n    },\n    \"loading\": \"lazy\"\n  })), \"\\n  \"), \"\\n    \"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"To try it out on your localhost, trigger the following endpoint: \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"http://localhost:8000/handled\"), \".\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Similar to the unhandled error, open the new issue's detail page.\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Notice that the event is tagged with the same \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"environment\"), \" and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"release\"), \" configuration options. Hover over the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"i\"), \" icon in the release tag to reveal the release information and the commits associated with it.\"), mdx(\"p\", {\n    parentName: \"li\"\n  }, mdx(\"span\", _extends({\n    parentName: \"p\"\n  }, {\n    \"className\": \"gatsby-resp-image-wrapper\",\n    \"style\": {\n      \"position\": \"relative\",\n      \"display\": \"block\",\n      \"marginLeft\": \"auto\",\n      \"marginRight\": \"auto\",\n      \"maxWidth\": \"1200px\"\n    }\n  }), \"\\n      \", mdx(\"a\", _extends({\n    parentName: \"span\"\n  }, {\n    \"className\": \"gatsby-resp-image-link\",\n    \"href\": \"/static/88540a5ef595b1c2b0e9c848321220a0/8454b/handled_release.png\",\n    \"style\": {\n      \"display\": \"block\"\n    },\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }), \"\\n    \", mdx(\"span\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-background-image\",\n    \"style\": {\n      \"paddingBottom\": \"74.33333333333333%\",\n      \"position\": \"relative\",\n      \"bottom\": \"0\",\n      \"left\": \"0\",\n      \"backgroundImage\": \"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAPCAIAAABr+ngCAAAACXBIWXMAAAsSAAALEgHS3X78AAACHElEQVQoz3VS2Y6cMBDk/38sT5ESbRJpc612ZhhgjLHx0e2bFLCr5CVS0Wqbrnb10T0e48fPT78ut0s/9eOsHCnrKZdQ2wku9QQuY9uGWf6+9vdJIrajEKU24Eyzmlf7WFZY5bz2JFc3a+tT3lPUeuYyHBBsQ/KpdNKS0MZyQNhhnfEEH0xlSRm/UtCeVx9wdCGlbYvtTVEnFvN6l2KND8UPFcYljCpQrKW1XNthay5v8ByMw5MVKLV1ISatndJOG+85KZcXh7C2bdv+Hba9+0iUMkytrQFdzpk8WedDQLp6xGznv/9gTwS7kwubcH3qB3G7DcP4cJ6BXEr7J0Vrf9+HKKWhncDvcCqQnstZFZzTh4WQEyEXH9MJF+LqyMeIdnTPL19enj/Mi3HO1aNURHOIwzChlrNmNLwfBVptKFzu03UUi/UZZEFKuYk5EaP59VSLVz0xegO9uDHEmCYE51pirvP9aleVILvkhpiCB9tWDhrklp3UkOuY1uYsy1Hsm2TZOzLGcIwJoyIOYt+qMEnsEylslcSqEbCsdjE8Gv9Nv3xdfn4S35/kD+lWjoUwpPZOFiZIbXcmfKmFpll7qYzU/r66ix2msPRB90Fyi6itbMecmcMk9EXQq+D7wr0ww+yEsujJIN11pttMvUiPJUmdtCmey9nFnRxzNtatPs02Kp8cR2Oxz2hsdJw0Je2TtHE2ATfoQn0fOMh/AEOeX/SFNVh+AAAAAElFTkSuQmCC')\",\n      \"backgroundSize\": \"cover\",\n      \"display\": \"block\"\n    }\n  })), \"\\n  \", mdx(\"img\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-image\",\n    \"alt\": \"Handled release\",\n    \"title\": \"Handled release\",\n    \"src\": \"/static/88540a5ef595b1c2b0e9c848321220a0/c1b63/handled_release.png\",\n    \"srcSet\": [\"/static/88540a5ef595b1c2b0e9c848321220a0/5a46d/handled_release.png 300w\", \"/static/88540a5ef595b1c2b0e9c848321220a0/0a47e/handled_release.png 600w\", \"/static/88540a5ef595b1c2b0e9c848321220a0/c1b63/handled_release.png 1200w\", \"/static/88540a5ef595b1c2b0e9c848321220a0/8454b/handled_release.png 1798w\"],\n    \"sizes\": \"(max-width: 1200px) 100vw, 1200px\",\n    \"style\": {\n      \"width\": \"100%\",\n      \"height\": \"100%\",\n      \"margin\": \"0\",\n      \"verticalAlign\": \"middle\",\n      \"position\": \"absolute\",\n      \"top\": \"0\",\n      \"left\": \"0\"\n    },\n    \"loading\": \"lazy\"\n  })), \"\\n  \"), \"\\n    \"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Click on the release's \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"i\"), \" icon to navigate to the release page.\"))), mdx(\"h3\", {\n    \"id\": \"capture-message\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h3\"\n  }, {\n    \"href\": \"#capture-message\",\n    \"aria-label\": \"capture message permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Capture Message\"), mdx(\"p\", null, \"Typically, \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"capture_message\"), \" is not emitted but there are times when a developer may want to add a simple message within their app for debugging purposes and \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"capture_message\"), \" is great for that.\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"In the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"views.py\"), \" file, the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"capture_message\"), \" method is made available through the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"sentry_sdk\"), \" lib import.\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"You can use it anywhere within your app. In our example, we've created a dedicated view class \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"CaptureMessageView\"), \" to trigger and capture a message we want to track\"), mdx(\"div\", _extends({\n    parentName: \"li\"\n  }, {\n    \"className\": \"code-tabs-wrapper\"\n  }), mdx(CodeTabs, {\n    mdxType: \"CodeTabs\"\n  }, mdx(CodeBlock, {\n    language: \"Python\",\n    title: \"\",\n    filename: \"\",\n    mdxType: \"CodeBlock\"\n  }, mdx(\"div\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"python\"\n  }), mdx(\"pre\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"language-python\"\n  }), mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-python\"\n  }), \"   sentry_sdk\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \".\"), \"capture_message\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"(\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token string\"\n  }), \"\\\"You caught me!\\\"\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \")\")))))))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"To try it out on your localhost, trigger the following endpoint: \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"http://localhost:8000/message\"), \".\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"As before, open the new issue\\u2019s detail page from your \", mdx(\"em\", {\n    parentName: \"p\"\n  }, \"Issues Stream\"), \".\"), mdx(\"p\", {\n    parentName: \"li\"\n  }, mdx(\"span\", _extends({\n    parentName: \"p\"\n  }, {\n    \"className\": \"gatsby-resp-image-wrapper\",\n    \"style\": {\n      \"position\": \"relative\",\n      \"display\": \"block\",\n      \"marginLeft\": \"auto\",\n      \"marginRight\": \"auto\",\n      \"maxWidth\": \"1200px\"\n    }\n  }), \"\\n      \", mdx(\"a\", _extends({\n    parentName: \"span\"\n  }, {\n    \"className\": \"gatsby-resp-image-link\",\n    \"href\": \"/static/0e5c9cd76f965650adbdf4ac090a292c/387f2/capture_message.png\",\n    \"style\": {\n      \"display\": \"block\"\n    },\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }), \"\\n    \", mdx(\"span\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-background-image\",\n    \"style\": {\n      \"paddingBottom\": \"64%\",\n      \"position\": \"relative\",\n      \"bottom\": \"0\",\n      \"left\": \"0\",\n      \"backgroundImage\": \"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAIAAAAmMtkJAAAACXBIWXMAAAsSAAALEgHS3X78AAAB5klEQVQoz3VS247UMAzt/38ZjwgBy2qZHc1Op9MmzT2xEydpcWcQvIBlWZbj48txBrGq19P5+9v7eZx8Ltg3aJ0V23ZoPxRqZ0215b5fF3m9i5tQk9RDCuF8ud6lNjHZhA4yW4/FRmBfuWAiPGuxzdsunV9d8JhjoWH1aVHOBJDaGw+rDUI5/QhKE6QNbG3KJiKr9gC10b5nnqj1wdi0rMFhtYlsJLYqFAdUaiutU+/EDVvL1LBQSDnxasSvR3zIhaSJq0WhuS3MhkZVTGz7Q7b9r/TeI2CIKSWg1mprgxWTHU/G+Zxx247kvm1U6ywk5PwEWx+XZVXaJMBnRdbKnb+ML2+XT0YHYx1PsR/RBpjnRSaAJ/hymb59/WmMtdb1frR4gNvw9P4njyb/eGdU69uxMw8DpabSoPRClA9KKlJjv5QWc4XSkHphIcIjs7ZtO8CMnIVeDN6luUurmHyxTgtH8qz9D3P6bN9f3SiVuwl/na0wcNDVNx5/ACxytbPBxQDfeRZW6rDopF0Syp/1/GKnd618IuR/VnoqnZE8OVcYAPIizW2Fi0hXCTcZuAMfb1GeS0wS72sZBX6IdFMwK1C+BKy/2WbSIo9easjHenykBAkyhdyJ6oOLynGPzWPNVP8QyZm/AHsq6pLZd2LRAAAAAElFTkSuQmCC')\",\n      \"backgroundSize\": \"cover\",\n      \"display\": \"block\"\n    }\n  })), \"\\n  \", mdx(\"img\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-image\",\n    \"alt\": \"Import and Configure SDK\",\n    \"title\": \"Import and Configure SDK\",\n    \"src\": \"/static/0e5c9cd76f965650adbdf4ac090a292c/c1b63/capture_message.png\",\n    \"srcSet\": [\"/static/0e5c9cd76f965650adbdf4ac090a292c/5a46d/capture_message.png 300w\", \"/static/0e5c9cd76f965650adbdf4ac090a292c/0a47e/capture_message.png 600w\", \"/static/0e5c9cd76f965650adbdf4ac090a292c/c1b63/capture_message.png 1200w\", \"/static/0e5c9cd76f965650adbdf4ac090a292c/387f2/capture_message.png 1518w\"],\n    \"sizes\": \"(max-width: 1200px) 100vw, 1200px\",\n    \"style\": {\n      \"width\": \"100%\",\n      \"height\": \"100%\",\n      \"margin\": \"0\",\n      \"verticalAlign\": \"middle\",\n      \"position\": \"absolute\",\n      \"top\": \"0\",\n      \"left\": \"0\"\n    },\n    \"loading\": \"lazy\"\n  })), \"\\n  \"), \"\\n    \")), mdx(\"blockquote\", {\n    parentName: \"li\"\n  }, mdx(\"p\", {\n    parentName: \"blockquote\"\n  }, \"By default captured messages are marked with a severity level tag \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"level:info\"), \" as reflected in the tags section. However, the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"capture_message\"), \" methods accept an \", mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"optional\"), \" severity level paramete.\"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"In the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"views.py\"), \" file, go ahead and change the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"capture_message\"), \" method to:\"), mdx(\"div\", _extends({\n    parentName: \"li\"\n  }, {\n    \"className\": \"code-tabs-wrapper\"\n  }), mdx(CodeTabs, {\n    mdxType: \"CodeTabs\"\n  }, mdx(CodeBlock, {\n    language: \"Python\",\n    title: \"\",\n    filename: \"\",\n    mdxType: \"CodeBlock\"\n  }, mdx(\"div\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"python\"\n  }), mdx(\"pre\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"language-python\"\n  }), mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-python\"\n  }), \"   sentry_sdk\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \".\"), \"capture_message\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"(\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token string\"\n  }), \"\\\"You caught me!\\\"\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \",\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token string\"\n  }), \"\\\"fatal\\\"\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \")\")))))))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Save the changes and trigger the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"/message\"), \" endpoint again. (Changes should be applied immediately through \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"StateReloader\"), \")\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Notice that the severity level tag on the new event now shows \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"level:fatal\"), \".\"))), mdx(\"h2\", {\n    \"id\": \"enriching-your-event-data\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h2\"\n  }, {\n    \"href\": \"#enriching-your-event-data\",\n    \"aria-label\": \"enriching your event data permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Enriching your Event Data\"), mdx(\"p\", null, \"You can enrich your event and error data through the Sentry SDK by adding custom tags and user context attributes. In addition to providing more context to your errors, those will expand your options to search, filter, and query through your event metadata. For more information on the advantages of enriching your data see \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"/product/sentry-basics/guides/enrich-data/\"\n  }), \"Put your Data to Work\"), \".\"), mdx(\"p\", null, \"Let's enrich the data of the message events we've captured with \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"capture_message\"), \".\"), mdx(\"ol\", null, mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"In the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"views.py\"), \" file, locate the line that triggers \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"sentry_sdk.capture_message\"), \".\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Replace that line with the following code:\"), mdx(\"div\", _extends({\n    parentName: \"li\"\n  }, {\n    \"className\": \"code-tabs-wrapper\"\n  }), mdx(CodeTabs, {\n    mdxType: \"CodeTabs\"\n  }, mdx(CodeBlock, {\n    language: \"Python\",\n    title: \"\",\n    filename: \"\",\n    mdxType: \"CodeBlock\"\n  }, mdx(\"div\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"gatsby-highlight\",\n    \"data-language\": \"python\"\n  }), mdx(\"pre\", _extends({\n    parentName: \"div\"\n  }, {\n    \"className\": \"language-python\"\n  }), mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-python\"\n  }), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token keyword\"\n  }), \"with\"), \" sentry_sdk\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \".\"), \"push_scope\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"(\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \")\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token keyword\"\n  }), \"as\"), \" scope\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \":\"), \"\\n   scope\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \".\"), \"set_tag\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"(\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token string\"\n  }), \"\\\"my-tag\\\"\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \",\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token string\"\n  }), \"\\\"my value\\\"\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \")\"), \"\\n   scope\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \".\"), \"user \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token operator\"\n  }), \"=\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"{\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token string\"\n  }), \"\\\"email\\\"\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \":\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token string\"\n  }), \"\\\"my.email@your.domain.com\\\"\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"}\"), \"\\n   scope\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \".\"), \"set_extra\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"(\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token string\"\n  }), \"\\\"someVariable\\\"\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \",\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token string\"\n  }), \"\\\"some data\\\"\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \")\"), \"\\n\\n   sentry_sdk\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \".\"), \"capture_message\", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \"(\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token string\"\n  }), \"\\\"You caught me!\\\"\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \",\"), \" \", mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token string\"\n  }), \"\\\"fatal\\\"\"), mdx(\"span\", _extends({\n    parentName: \"code\"\n  }, {\n    \"className\": \"token punctuation\"\n  }), \")\"))))))), mdx(\"blockquote\", {\n    parentName: \"li\"\n  }, mdx(\"p\", {\n    parentName: \"blockquote\"\n  }, \"Note: we're using the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"push_scope\"), \" method that allows us to send data with one specific event on a local scope. We're setting a custom tag, user context attribute (email), and extra data on the local scope to enrich the data on the message event.\"))), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Save your changes and trigger the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"/message\"), \" endpoint again.\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Open the issue\\u2019s detail page from your \", mdx(\"em\", {\n    parentName: \"p\"\n  }, \"Issues Stream\"), \".\")), mdx(\"li\", {\n    parentName: \"ol\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, \"Notice that:\"), mdx(\"ul\", {\n    parentName: \"li\"\n  }, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"The \", mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"user email\"), \" is now displayed on the details page and the number of unique users impacted by this event is reflected in the issue's header.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"The \", mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"custom tag\"), \" is now available (and searchable) in the list of tags.\\n\", mdx(\"span\", _extends({\n    parentName: \"li\"\n  }, {\n    \"className\": \"gatsby-resp-image-wrapper\",\n    \"style\": {\n      \"position\": \"relative\",\n      \"display\": \"block\",\n      \"marginLeft\": \"auto\",\n      \"marginRight\": \"auto\",\n      \"maxWidth\": \"1200px\"\n    }\n  }), \"\\n      \", mdx(\"a\", _extends({\n    parentName: \"span\"\n  }, {\n    \"className\": \"gatsby-resp-image-link\",\n    \"href\": \"/static/8ada8162ac1cfc98ea5af913e10a920f/ade5e/enriched_data_1.png\",\n    \"style\": {\n      \"display\": \"block\"\n    },\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }), \"\\n    \", mdx(\"span\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-background-image\",\n    \"style\": {\n      \"paddingBottom\": \"45.33333333333333%\",\n      \"position\": \"relative\",\n      \"bottom\": \"0\",\n      \"left\": \"0\",\n      \"backgroundImage\": \"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAIAAAC9o5sfAAAACXBIWXMAAAsSAAALEgHS3X78AAABYElEQVQozy1Q247cIAzN/39Q/6EvfdhVVamalXZnNblMgBDANmBM6klqHeyDhS+HYRynPx+fi9uQBbmdYKhMTS5k6bPbZuNcBCxiS/pdbgv5kPKwRdiRdiCfcAfUqwtg9pgKQ2nqtT7mogBuJB1FfKPEjE0Gu8bVod2LUfgKuRXmXP+D9IhQ4SqdtTLXBFT5xRXDDb6nYOZoZtju20IIIv04DhHhykoQCJFaE+UAaIwjysdpww/78xumMY3PvL7Nv6bH35hIpGmBc5u++Pp8WONKrcpTAu+D9lXeex9YTRp3aSfknNk19KNr1NzxItfkWplbU9I0IzLsPixrMJ6s9YsJdkP9+Xd3e9/v4/acnvFhcU9ZlV5arrFq2mUIIU0mTo7GNU4WZouTjXe7fjm7+LT6/HTx6SkRX2u300KAPaShVI5UA1YPFakmLJEYsIH+0bnyS1x/+av4pVJ6gkKZ/wGhLAYcS9QnrgAAAABJRU5ErkJggg==')\",\n      \"backgroundSize\": \"cover\",\n      \"display\": \"block\"\n    }\n  })), \"\\n  \", mdx(\"img\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-image\",\n    \"alt\": \"Enriched Event Data\",\n    \"title\": \"Enriched Event Data\",\n    \"src\": \"/static/8ada8162ac1cfc98ea5af913e10a920f/c1b63/enriched_data_1.png\",\n    \"srcSet\": [\"/static/8ada8162ac1cfc98ea5af913e10a920f/5a46d/enriched_data_1.png 300w\", \"/static/8ada8162ac1cfc98ea5af913e10a920f/0a47e/enriched_data_1.png 600w\", \"/static/8ada8162ac1cfc98ea5af913e10a920f/c1b63/enriched_data_1.png 1200w\", \"/static/8ada8162ac1cfc98ea5af913e10a920f/d61c2/enriched_data_1.png 1800w\", \"/static/8ada8162ac1cfc98ea5af913e10a920f/ade5e/enriched_data_1.png 2188w\"],\n    \"sizes\": \"(max-width: 1200px) 100vw, 1200px\",\n    \"style\": {\n      \"width\": \"100%\",\n      \"height\": \"100%\",\n      \"margin\": \"0\",\n      \"verticalAlign\": \"middle\",\n      \"position\": \"absolute\",\n      \"top\": \"0\",\n      \"left\": \"0\"\n    },\n    \"loading\": \"lazy\"\n  })), \"\\n  \"), \"\\n    \")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"The \", mdx(\"strong\", {\n    parentName: \"li\"\n  }, \"extra data\"), \" we set on the SDK is reflected in the Additional Data context\\n\", mdx(\"span\", _extends({\n    parentName: \"li\"\n  }, {\n    \"className\": \"gatsby-resp-image-wrapper\",\n    \"style\": {\n      \"position\": \"relative\",\n      \"display\": \"block\",\n      \"marginLeft\": \"auto\",\n      \"marginRight\": \"auto\",\n      \"maxWidth\": \"1200px\"\n    }\n  }), \"\\n      \", mdx(\"a\", _extends({\n    parentName: \"span\"\n  }, {\n    \"className\": \"gatsby-resp-image-link\",\n    \"href\": \"/static/23e4e699278c5885e5ef37c3f0f3cf1d/6ee58/enriched_data_2.png\",\n    \"style\": {\n      \"display\": \"block\"\n    },\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }), \"\\n    \", mdx(\"span\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-background-image\",\n    \"style\": {\n      \"paddingBottom\": \"21.333333333333336%\",\n      \"position\": \"relative\",\n      \"bottom\": \"0\",\n      \"left\": \"0\",\n      \"backgroundImage\": \"url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAECAIAAAABPYjBAAAACXBIWXMAAAsSAAALEgHS3X78AAAAXElEQVQI143MQQ6EMAxD0d7/qkxBgoYmjeOAWCBW1Vhv5cUv0qQuFQCZIq6K4TFhhvrr+24RUU45W5PMJLmufdu6mnedGQ4dgEfJd+Rx2O1u/wOIwuAr+UQ+z9wFgZDq4IWJXrMAAAAASUVORK5CYII=')\",\n      \"backgroundSize\": \"cover\",\n      \"display\": \"block\"\n    }\n  })), \"\\n  \", mdx(\"img\", _extends({\n    parentName: \"a\"\n  }, {\n    \"className\": \"gatsby-resp-image-image\",\n    \"alt\": \"Enriched Event Data 2\",\n    \"title\": \"Enriched Event Data 2\",\n    \"src\": \"/static/23e4e699278c5885e5ef37c3f0f3cf1d/c1b63/enriched_data_2.png\",\n    \"srcSet\": [\"/static/23e4e699278c5885e5ef37c3f0f3cf1d/5a46d/enriched_data_2.png 300w\", \"/static/23e4e699278c5885e5ef37c3f0f3cf1d/0a47e/enriched_data_2.png 600w\", \"/static/23e4e699278c5885e5ef37c3f0f3cf1d/c1b63/enriched_data_2.png 1200w\", \"/static/23e4e699278c5885e5ef37c3f0f3cf1d/6ee58/enriched_data_2.png 1640w\"],\n    \"sizes\": \"(max-width: 1200px) 100vw, 1200px\",\n    \"style\": {\n      \"width\": \"100%\",\n      \"height\": \"100%\",\n      \"margin\": \"0\",\n      \"verticalAlign\": \"middle\",\n      \"position\": \"absolute\",\n      \"top\": \"0\",\n      \"left\": \"0\"\n    },\n    \"loading\": \"lazy\"\n  })), \"\\n  \"), \"\\n    \"))))));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#unhandled-errors","title":"Unhandled Errors"},{"url":"#handled-errors","title":"Handled Errors","items":[{"url":"#capture-exception","title":"Capture Exception"},{"url":"#capture-message","title":"Capture Message"}]},{"url":"#enriching-your-event-data","title":"Enriching your Event Data"}]},"internal":{"type":"Mdx"}}}},"pageContext":{"excerpt":"Once initialized in your code, the Sentry SDK will capture various types of events and notify you about them in real-time, depending on the alert rules you've configured. With the Django app already running on your  localhost , let's try them out. Note:  If you're using your own source code, follow  Capturing your first event  to introduce an error into your app. Unhandled Errors The Sentry SDK will automatically capture and report any Unhandled Error that happens in your application runtime without any additional configuration or explicit handling. Generally, Unhandled Errors are errors the aren't caught by any except (or try/catch) clause. In your browser, launch the local Django app in the following endpoint to trigger an unhandled error:  http://localhost:8000/unhandled . If you've set up an alert rule, you should be notified about the error. Otherwise, open the  Issues  view in your Sentry account. Notice the unhandled exception appears in your  Issues Stream . Click on the issue, to open the issue details page. Notice that the event: Is tagged with the  environment  and  release  options we've set in the previous tutorial and  handled:no  - marking this event as an unhandled error. Contains a  Suspect Commit  enabled by the commit tracking feature we enabled previously. Contains the custom breadcrumb we added through the SDK. Handled Errors The Sentry SDK contains several methods that you can utilize to  explicitly  report errors, events, and custom messages in except clauses, critical areas of your code, etc. Capture Exception Open the  views.py  file. Notice that we import  sentry_sdk  lib which contains the  capture_exception  method The method is utilized to capture the exception handled by the except clause in  HandledErrorView . To try it out on your localhost, trigger the following endpoint:  http://localhost:8000/handled . Similar to the unhandled error, open the new issue's detail page. Notice that the event is tagged with the same  environment  and  release  configuration options. Hover over the  i  icon in the release tag to reveal the release information and the commits associated with it. Click on the release's  i  icon to navigate to the release page. Capture Message Typically,  capture_message  is not emitted but there are times when a developer may want to add a simple message within their app for debugging purposes and  capture_message  is great for that. In the  views.py  file, the  capture_message  method is made available through the  sentry_sdk  lib import. You can use it anywhere within your app. In our example, we've created a dedicated view class  CaptureMessageView  to trigger and capture a message we want to track To try it out on your localhost, trigger the following endpoint:  http://localhost:8000/message . As before, open the new issue’s detail page from your  Issues Stream . By default captured messages are marked with a severity level tag  level:info  as reflected in the tags section. However, the  capture_message  methods accept an  optional  severity level paramete. In the  views.py  file, go ahead and change the  capture_message  method to: Save the changes and trigger the  /message  endpoint again. (Changes should be applied immediately through  StateReloader ) Notice that the severity level tag on the new event now shows  level:fatal . Enriching your Event Data You can enrich your event and error data through the Sentry SDK by adding custom tags and user context attributes. In addition to providing more context to your errors, those will expand your options to search, filter, and query through your event metadata. For more information on the advantages of enriching your data see  Put your Data to Work . Let's enrich the data of the message events we've captured with  capture_message . In the  views.py  file, locate the line that triggers  sentry_sdk.capture_message . Replace that line with the following code: Note: we're using the  push_scope  method that allows us to send data with one specific event on a local scope. We're setting a custom tag, user context attribute (email), and extra data on the local scope to enrich the data on the message event. Save your changes and trigger the  /message  endpoint again. Open the issue’s detail page from your  Issues Stream . Notice that: The  user email  is now displayed on the details page and the number of unique users impacted by this event is reflected in the issue's header. The  custom tag  is now available (and searchable) in the list of tags.\n The  extra data  we set on the SDK is reflected in the Additional Data context\n","title":"Capturing Errors","description":null,"draft":null,"noindex":null,"notoc":null,"sidebar_order":null,"redirect_from":["/guides/integrate-backend/capturing-errors/"],"keywords":null,"id":"2522ac3a-9092-5c98-9a30-afd011ed2d5e","legacy":false}},"staticQueryHashes":["1218203755","1222113826","1222113826","1766336459","2158593473","2764967025","3345802723","3818502851","3990806462","4015007367","4192517163","4264099332","518019976"]}