Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add support for badrecord errors #48

Merged
merged 1 commit into from

2 participants

@Vagabond
Collaborator

No description provided.

@Vagabond Vagabond was assigned
@russelldb russelldb was assigned
@russelldb
Owner

Looks good, tests pass +1.

@Vagabond Vagabond was assigned
@Vagabond Vagabond merged commit 698c991 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 9, 2012
  1. @Vagabond
This page is out of date. Refresh to see the latest.
View
2  src/error_logger_lager_h.erl
@@ -202,6 +202,8 @@ format_reason({bad_return_value, Val}) ->
["bad return value: ", print_val(Val)];
format_reason({{bad_return_value, Val}, MFA}) ->
["bad return value: ", print_val(Val), " in ", format_mfa(MFA)];
+format_reason({{badrecord, Record}, [MFA|_]}) ->
+ ["bad record ", print_val(Record), " in ", format_mfa(MFA)];
format_reason({{case_clause, Val}, [MFA|_]}) ->
["no case clause matching ", print_val(Val), " in ", format_mfa(MFA)];
format_reason({function_clause, [MFA|_]}) ->
View
8 test/crash.erl
@@ -9,6 +9,11 @@
-export([start/0]).
+-record(state, {
+ host,
+ port
+ }).
+
start() ->
gen_server:start({local, ?MODULE}, ?MODULE, [], []).
@@ -49,6 +54,9 @@ handle_call(try_clause, _, State) ->
handle_call(badmatch, _, State) ->
{A, B, C} = State,
{reply, [A, B, C], State};
+handle_call(badrecord, _, State) ->
+ Host = State#state.host,
+ {reply, Host, State};
handle_call(function_clause, _, State) ->
{reply, function(State), State};
handle_call(badarith, _, State) ->
View
9 test/lager_test_backend.erl
@@ -404,6 +404,15 @@ error_logger_redirect_crash_test_() ->
test_body(Expected, lists:flatten(Msg))
end
},
+ {"bad record",
+ fun() ->
+ Pid = whereis(crash),
+ crash(badrecord),
+ {_, _, Msg} = pop(),
+ Expected = lists:flatten(io_lib:format("[error] ~w gen_server crash terminated with reason: bad record state in crash:handle_call/3", [Pid])),
+ test_body(Expected, lists:flatten(Msg))
+ end
+ },
{"noproc",
fun() ->
Pid = whereis(crash),
Something went wrong with that request. Please try again.