exceptional v1.3.0 Release Notes

Release Date: 2016-12-18 // over 7 years ago
  • safe/1 & safe/2 (plus pun aliases: lower/1 and lower/2 make functions that raise exceptions return those exceptions instead.

    Does not catch throws, because that causes all sorts of odd behaviour (REPL errors returned as tuples or (structs if normalized), then they get piped into functions... all sorts of mess).

    toothless\_fetch = safe(&Enum.fetch!/2) [1,2,3] |\> toothless\_fetch.(1)#=\> 2toothless = safe(&Enum.fetch!/2) [1,2,3] |\> toothless.(999)#=\> %Enum.OutOfBoundsError{message: "out of bounds error"}safe(&Enum.fetch!/2).([1,2,3], 999)#=\> %Enum.OutOfBoundsError{message: "out of bounds error"}