Sha256: 3d25e48b5385c0844fe9b98077b351b4b408ee42020e2a6924f411507aecbe51

Contents?: true

Size: 1.07 KB

Versions: 26

Compression:

Stored size: 1.07 KB

Contents

## Error Handling

At the moment we only support [sentry](https://sentry.io) for error alerting.

You can configure the sentry DNS through "sapience.yml", using the "error_handler" section shown in the example below.
(note that you can use an environment variable, as in the example below, or just put the DNS in plain text if you prefer).
```yml
production:
  log_level: info

  error_handler:
    sentry:
      dsn: <%= ENV['SENTRY_DSN'] %>

```
or through ruby code as below:

```ruby
Sapience.error_handler = { sentry: { dsn: ENV["SENTRY_DSN"] } }
```
Then you can send error messages to Sentry using the following two public methods in Sapience:

```ruby
  capture_exception(exception, payload = {})
  capture_message(message, payload = {})
```

As in the example below:
```ruby
begin
  (do somehting)
rescue MyException => e
  Sapience.capture_exception(e)
  raise e
end
```

You can also test that you've configured the DNS correctly by using the "test_exception" method, that will send a test message to your configured Sentry project. See below.

```ruby
Sapience.test_exception(:error)
```

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
sapience-3.0 docs/error_handler.md
sapience-2.15 docs/error_handler.md
sapience-2.14 docs/error_handler.md
sapience-2.13 docs/error_handler.md
sapience-2.12 docs/error_handler.md
sapience-2.11 docs/error_handler.md
sapience-2.10 docs/error_handler.md
sapience-2.9.1 docs/error_handler.md
sapience-2.8 docs/error_handler.md
sapience-2.7.0 docs/error_handler.md
sapience-2.6.1 docs/error_handler.md
sapience-2.6.0 docs/error_handler.md
sapience-2.5.4 docs/error_handler.md
sapience-2.5.3 docs/error_handler.md
sapience-2.5.2 docs/error_handler.md
sapience-2.5.0 docs/error_handler.md
sapience-2.4.0 docs/error_handler.md
sapience-2.3.5 docs/error_handler.md
sapience-2.3.4 docs/error_handler.md
sapience-2.3.3 docs/error_handler.md