CredoExceptionSwallow.Checks.Warning.SilentRescue (CredoExceptionSwallow v0.3.0)
View SourceBasics
This check is disabled by default.
Learn how to enable it via .credo.exs.
This check has a base priority of high and works with any version of Elixir.
Explanation
Rescue blocks should not silently swallow exceptions. Every caught exception should be either:
- Logged (using Logger)
- Reported to error monitoring (Sentry/ErrorReporter)
- Re-raised (using reraise)
Silent exception handling hides bugs and makes debugging nearly impossible. This check enforces a zero-tolerance policy for exception swallowing.
Check-Specific Parameters
Use the following parameters to configure this check:
:skip_test_files
Whether to skip test files (default: true)
This parameter defaults to true.
:acceptable_calls
List of function calls that indicate proper error handling
This parameter defaults to ["Logger.error", "Logger.warning", "Logger.warn", "Logger.info", "Logger.debug", "ErrorReporter.report_exception", "ErrorReporter.report_message", "Sentry.capture_exception", "Sentry.capture_message", "reraise", "raise"].
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.