OeditusCredo.Check.Warning.SwallowingException
(OeditusCredo v0.5.0)
View Source
Basics
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
Swallowing exceptions in try/rescue without re-raising or logging hides errors.
Always log exceptions or re-raise them to maintain observability.
Bad:
try do
risky_operation()
rescue
_ -> :error
endGood:
try do
risky_operation()
rescue
e ->
Logger.error("Operation failed", error: inspect(e))
:error
endCheck-Specific Parameters
Use the following parameters to configure this check:
:exclude_test_files
Set to true to skip test files (default: false)
This parameter defaults to nil.
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.