zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

error.ex (729B)


      1 defmodule Decimal.Error do
      2   @moduledoc """
      3   The exception that all decimal operations may raise.
      4 
      5   ## Fields
      6 
      7     * `signal` - the signalled error, additional signalled errors will be found
      8       in the context.
      9     * `reason` - the reason for the error.
     10 
     11   Rescuing the error to access the result or the other fields of the error is
     12   discouraged and should only be done for exceptional conditions. It is more
     13   pragmatic to set the appropriate traps on the context and check the flags
     14   after the operation if the result needs to be inspected.
     15   """
     16 
     17   defexception [:signal, :reason]
     18 
     19   @impl true
     20   def message(%{signal: signal, reason: reason}) do
     21     reason = reason && ": " <> reason
     22     "#{signal}#{reason}"
     23   end
     24 end