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

Anthony wong/log wrong details type #44

Merged
merged 2 commits into from Jan 10, 2019

Conversation

Projects
None yet
5 participants
@Anthony-Wong
Copy link
Contributor

Anthony-Wong commented Jan 7, 2019

No description provided.

Anthony-Wong added some commits Jan 4, 2019

@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Jan 7, 2019

Codecov Report

Merging #44 into master will decrease coverage by 0.36%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #44      +/-   ##
==========================================
- Coverage      76%   75.63%   -0.37%     
==========================================
  Files           7        7              
  Lines         350      353       +3     
  Branches       57       58       +1     
==========================================
+ Hits          266      267       +1     
- Misses         47       48       +1     
- Partials       37       38       +1
Impacted Files Coverage Δ
lib/Mojolicious/Plugin/WebSocketProxy.pm 76.08% <33.33%> (-2.99%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9442fb9...f6a82f3. Read the comment docs.


if ($details && ref($details) ne 'HASH') {
$log->debugf("Details in a websocket error must be a hash reference instead of a %s", ref($details));
}

This comment has been minimized.

@zakame

zakame Jan 8, 2019

Contributor

Maybe $details could be tested only once like

if ($details && ref $details eq 'HASH' && keys %$details) {
    $log->debugf("Details in a websocket error must be a hash reference");
}
else {
    $error->{details} = $details;
}

This comment has been minimized.

@Anthony-Wong

Anthony-Wong Jan 8, 2019

Contributor

I assume you meant the if/else to be swapped, but that won't be entirely accurate though, as if details is missing, we shouldn't log any error. The only way I can think of to do this otherwise is with a nested if block (which may / may not make it messier). Thoughts?

This comment has been minimized.

@turnstep

turnstep Jan 8, 2019

Think it's okay as is, FWIW.

@jy-binary jy-binary merged commit ae57b71 into binary-com:master Jan 10, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment