Permalink
Browse files

Adds minimal error reporting facility

  • Loading branch information...
Yurii Rashkovskii authored and DeadZen committed Feb 6, 2012
1 parent 1e0b642 commit 40b4c9f5a64f381f3d759b34b01e1fb520f3edcf
Showing with 19 additions and 1 deletion.
  1. +7 −0 apps/htoad/include/stdlib.hrl
  2. +2 −1 apps/htoad/src/htoad.app.src
  3. +10 −0 apps/htoad/src/htoad_error.erl
@@ -35,3 +35,10 @@
cmd,
run_as :: undefined | superuser | term()
}).
+
+-record(error_report,
+ {
+ rule,
+ fact,
+ reason
+ }).
@@ -29,7 +29,8 @@
htoad_pkg_brew,
htoad_pkg_apt,
htoad_io,
- htoad_shell
+ htoad_shell,
+ htoad_error
]}
]}
@@ -0,0 +1,10 @@
+-module(htoad_error).
+-include_lib("htoad/include/htoad.hrl").
+-include_lib("htoad/include/toadie.hrl").
+-include_lib("htoad/include/stdlib.hrl").
+
+-rules([report]).
+
+report(Engine, #error_report{ rule = R, fact = F, reason = Reason }) ->
+ lager:error("Rule ~p failed to process the assertion of ~p with reason: ~p", [R, F, Reason]),
+ Engine.

0 comments on commit 40b4c9f

Please sign in to comment.