svc_error/extension/mod.rs
1#[cfg(feature = "sqlx")]
2mod sqlx;
3
4#[cfg(feature = "r2d2")]
5mod r2d2;
6
7#[cfg(feature = "svc-agent")]
8mod svc_agent;
9
10#[cfg(feature = "svc-authn")]
11mod svc_authn;
12
13#[cfg(feature = "svc-authz")]
14mod svc_authz;
15
16/// Integration with Sentry exception tracker.
17///
18/// Setup:
19/// 1. Enable `sentry-extension` feature in `Cargo.toml`:
20/// ```toml
21/// svc_error = { version = "0.1", features = ["sentry-extension"] }
22/// ```
23/// 2. Add `sentry` section to your app's config of type `svc_error::extension::sentry::Config`:
24/// ```rust
25/// use serde::Deserialize;
26///
27/// #[derive(Deserialize)]
28/// struct MyAppConfig {
29/// sentry: svc_error::extension::sentry::Config,
30/// }
31/// ```
32/// 3. When initializing your app call:
33/// ```rust,ignore
34/// svc_error::extension::sentry::init(&config.sentry);
35/// ```
36/// It spawns a thread for asynchonous error sending.
37/// 4. Send an `svc_error::Error` or any other type that implements `svc_error::ProblemDetails`
38/// to whenever you like it to be sent to Sentry:
39/// ```rust,ignore
40/// let err = svc_error::Error::builder().detail("Something bad").build();
41/// svc_error::extension::sentry::send(err)?;
42/// ```
43#[cfg(feature = "sentry")]
44pub mod sentry;