record
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0 (0)
- 7.1.3.2 (38)
- 7.1.3.4 (0)
- What's this?
record(*error_classes, severity: :error, context: {}, source: DEFAULT_SOURCE)
public
Evaluates the given block, reporting and re-raising any unhandled error. If no error is raised, returns the return value of the block.
# Will report a TypeError to all subscribers and re-raise it. Rails.error.record do 1 + '1' end
Can be restricted to handle only specific error classes:
tags = Rails.error.record(Redis::BaseError) { redis.get("tags") }
Options
-
:severity - This value is passed along to subscribers to indicate how important the error report is. Can be :error, :warning, or :info. Defaults to :error.
-
:context - Extra information that is passed along to subscribers. For example:
Rails.error.record(context: { section: "admin" }) do # ... end
-
:source - This value is passed along to subscribers to indicate the source of the error. Subscribers can use this value to ignore certain errors. Defaults to "application".