Search
 
SCRIPT & CODE EXAMPLE
 

ELIXIR

elixir try rescue

defmodule SomeModule do
  @doc """
      iex> SomeModule.do_something()
      {:error, "%ArgumentError{message: "You provided a wrong argument"}"}
  """
  def do_something() do
    raise ArgumentError, "You provided a wrong argument"
  rescue
    error -> {:error, inspect(error)}
  end

  @doc """
      iex> SomeModule.try_something()
      {:error, "%ArgumentError{message: "You provided a wrong argument"}"}
  """
  def try_something() do
    try do
      raise ArgumentError, "You provided a wrong argument"
    rescue
      error -> {:error, inspect(error)}
    end
  end
end
Comment

PREVIOUS NEXT
Code Example
Elixir :: elixir catch 
Elixir :: elixir join list of strings 
Elixir :: elixir replace string 
Elixir :: phoenix system get env 
Elixir :: elixir 
Elixir :: phoenix ecto preload 
Elixir :: create new project phoenix 
Elixir :: elixir "hd" programming 
Scala :: scala list get element 
Scala :: equivalent of spark datetype in scala 
Scala :: scala yield how to share one loop 
Scala :: scala list of options to option of list 
Actionscript :: vivo y11 not connecting to wifi after update 
Excel :: excel hyperlink reference not updating when inserting rows 
Excel :: and in excel 
Perl :: perl remove all whitespace 
Perl :: what is perl poetry 
Pascal :: pascal delay 
Powershell :: takeown /f 
Gdscript :: godot 2d set position to mouse 
Abap :: adobre forms abap tcode 
Assembly :: MOD OPERATOR for register in arm assembly 
Assembly :: iterate over tqdm range 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: remove non letters from a string javascript 
Javascript :: window.reload 
Javascript :: javascript split and trim 
Javascript :: update node.js dependencies 
Javascript :: javascript to detect browser 
Javascript :: how to get element by title js 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =