Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Bug in parse_message #11

Merged
merged 1 commit into from
Aug 12, 2021
Merged

fix: Bug in parse_message #11

merged 1 commit into from
Aug 12, 2021

Conversation

moritzploss-k
Copy link

@moritzploss-k moritzploss-k commented Aug 12, 2021

About

raven_error_logger is removed from the list of error_logger event listeners every time we hit this exception in kivra_core. What I can see in the kivra_core logs is something like this:

14:57:27.149 [error] Exception: {{throw,{error,timeout}},[{s2_maybe,unlift,1,[{file,"/build/kivra_core/_build/default/lib/stdlib2/src/s2_maybe.erl"},{line,93}]},{client_kampanha,access_token,3,[{file,"/build/kivra_core/src/kivra_client/client_kampanha.erl"},{line,101}]},{client_kampanha,get_content_campaigns,2,[{file,"/build/kivra_core/src/kivra_client/client_kampanha.erl"},{line,42}]},{active_content,overlay,6,[{file,"/build/kivra_core/src/kivra_core/active_content.erl"},{line,52}]},{rest_user_content_key_v2,get_content,1,[{file,"/build/kivra_core/src/rest/user/rest_user_content_key_v2.erl"},{line,93}]},{timer,tc,1,[{file,"timer.erl"},{line,166}]},{kivra_metrics,time_mfa,2,[{file,"/build/kivra_core/_build/default/lib/kivra_metrics/src/kivra_metrics.erl"},{line,43}]},{s2_maybe,lift,1,[{file,"/build/kivra_core/_build/default/lib/stdlib2/src/s2_maybe.erl"},{line,74}]}]}
14:57:27.149 [error] gen_event raven_error_logger installed in error_logger terminated with reason: {badarg,warning}

I think this is because the following line in raven_error_logger is not valid Erlang:

TheLevel = ExtrasLevel orelse Level

Since ExtrasLevel = warning in the case of the above exception, the above line boils down to something like this:

TheLevel = warning orelse error

which will throw an exception ** exception error: bad argument: warning since the term on the left side of orelse is not a boolean.

Copy link
Member

@maxno-kivra maxno-kivra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment about jsx, but otherwise this looks good. As the reviewer of the last PR I feel a little bit guilty. I really though orelse handled truthy values, and why we use it instead of or. You learn something everyday.

rebar.config Outdated Show resolved Hide resolved
@moritzploss-k moritzploss-k merged commit 61bbd8e into kivra Aug 12, 2021
@moritzploss-k moritzploss-k deleted the moritz--fix-bug branch August 12, 2021 12:32
@moritzploss-k moritzploss-k removed the request for review from a team August 12, 2021 14:53
@zigge-zagge
Copy link

Thanks for cleaning up that bug I created in the last PR. Not sure where I got my inspiration from but I hope you had fun tracking it down 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants