-
Notifications
You must be signed in to change notification settings - Fork 17
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 NullPointerException with unregistered response code #92
Fix NullPointerException with unregistered response code #92
Conversation
* Checks registered response codes before marking * Adds a few additional default response codes * Misc. GoogleJavaFormat fixes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@@ -89,7 +93,9 @@ private void executeHandler(ChannelHandlerContext ctx, int streamId, Route route | |||
.handle(ctx.channel().attr(XrpcConstants.XRPC_REQUEST).get()); | |||
} | |||
|
|||
xctx.getMetersByStatusCode().get(h1Resp.status()).mark(); | |||
Optional<Meter> responseMap = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really a map, or a response, maybe call it something like statusMeter?
@@ -89,7 +93,9 @@ private void executeHandler(ChannelHandlerContext ctx, int streamId, Route route | |||
.handle(ctx.channel().attr(XrpcConstants.XRPC_REQUEST).get()); | |||
} | |||
|
|||
xctx.getMetersByStatusCode().get(h1Resp.status()).mark(); | |||
Optional<Meter> responseMap = | |||
Optional.ofNullable(xctx.getMetersByStatusCode().get(h1Resp.status())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the getMetersByStatusCode() map should be wrapped to return an Optional. You shouldn't have to wrap it here...
* Rename `responseMap` to `statusMeter`
@spenserpothier this can be merged |
* This commit somehow didn't get pushed to #92.
Fixes #85