Skip to content

Instantly share code, notes, and snippets.

@marianoguerra
marianoguerra / error.erl
Last active October 9, 2016 19:23 — forked from anonymous/error.erl
Standard Error Format for Erlang
-record(error, {type, ctx}).
% TODO: macros to create error adding module, line and function to context
% TODO: line(#error{}), module(#error{}), function(#error{}) to return those fields if defined or undefined if not
% TODO: pretty printer
new(Type) -> new(Type, #{}).
new(Type, Ctx) -> #error{type=Type, ctx=Ctx}.