Bash.SyntaxError exception (Bash v0.3.0)

Copy Markdown View Source

Exception raised when bash script parsing or validation fails.

Error codes follow ShellCheck conventions where applicable:

  • SC1xxx: Syntax errors (parser-level)
  • SC2xxx: Semantic warnings (future)

Example

iex> raise Bash.SyntaxError,
...>   code: "SC1046",
...>   line: 1,
...>   column: 0,
...>   script: "if true; then echo",
...>   hint: "'if' without matching 'fi'"

Produces:

** (Bash.SyntaxError) [SC1046] Bash syntax error at line 1, column 0:

    if true; then echo
    ^

  hint: 'if' without matching 'fi'

Reference: https://www.shellcheck.net/wiki/

Summary

Types

t()

@type t() :: %Bash.SyntaxError{
  __exception__: true,
  code: String.t() | nil,
  column: non_neg_integer() | nil,
  hint: String.t() | nil,
  line: pos_integer() | nil,
  message: String.t() | nil,
  script: String.t() | nil
}