# `Bylaw.Credo.Check.Elixir.NoRaise`
[🔗](https://github.com/ryanzidago/bylaw/blob/v0.4.0/lib/bylaw/credo/check/elixir/no_raise.ex#L1)

## Basics

> #### This check is disabled by default. {: .neutral}
>
> [Learn how to enable it](`e:credo:config_file.html#checks`) via `.credo.exs`.

This check has a base priority of `high` and works with any version of Elixir.

## Explanation

Prefer returning tagged results and handling them with `with` expressions
that include an explicit `else` clause at application boundaries.

Explicit result values keep expected failures in the function contract,
allowing callers to handle them without rescuing or catching control flow.
This makes failures composable across boundaries and keeps the successful
path honest about the operations that can fail.

## Examples

Avoid:

      user = Repo.get!(User, id)
      {:ok, account} = Accounts.fetch_account(user)
      raise "boom"
Prefer:

      with {:ok, user} <- Accounts.fetch_user(id),
           {:ok, account} <- Accounts.fetch_account(user) do
        {:ok, account}
      else
        {:error, reason} -> {:error, reason}
      end

## Notes

Path exclusions are matched against the source filename and are intended for generated files or temporary migration areas.

The check uses static AST analysis, so dynamic code generation and macro-expanded code may fall outside its signal.

## Options

Configure options in `.credo.exs` with the check tuple:

```elixir
%{
  configs: [
    %{
      name: "default",
      checks: [
        {Bylaw.Credo.Check.Elixir.NoRaise,
         [
           excluded_paths: ["test/support/"]
         ]}
      ]
    }
  ]
}
```

- `:excluded_paths` - List of paths or regex to exclude from this check

## Usage

Add this check to Credo's `checks:` list in `.credo.exs`:

```elixir
%{
  configs: [
    %{
      name: "default",
      checks: [
        {Bylaw.Credo.Check.Elixir.NoRaise, []}
      ]
    }
  ]
}
```

## Check-Specific Parameters

Use the following parameters to configure this check:

### `:excluded_paths`

  List of paths or regex to exclude from this check

*This parameter defaults to* `[]`.

## General Parameters

Like with all checks, [general params](`e:credo:check_params.html`) can be applied.

Parameters can be configured via the [`.credo.exs` config file](`e:credo:config_file.html`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
