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 string concatination 
Elixir :: elixir hello world 
Elixir :: elixir enum map 
Elixir :: elixir datetime to timestamp 
Elixir :: elixir enum all 
Elixir :: mix install phoenix 
Elixir :: phoenix run test 
Elixir :: elixir Creating Custom Sigils 
Scala :: two dimensional array scala 
Scala :: scala Datetime parse 
Scala :: get first string from list scala 
Scala :: scala get set of chars from string 
Actionscript :: octahedron 
Excel :: excel formula update insert row column 
Excel :: and function in excel 
Perl :: perl read file 
Perl :: perl mechanize infinite scroll with attempt count 
Pascal :: pascal pause program for seconds 
Powershell :: takeown cmd 
Gdscript :: godot make string all lowercase 
Abap :: what is the interface between the abap dictionary and the underlying database management system 
Assembly :: x86 assembly hello world 
Assembly :: dd utility explained examples 
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
3+9 =