forked from line/armeria
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix not to raise an exception from `(Service|Client)RequestContext.cu… (
line#2962) * Fix not to raise an exception from `(Service|Client)RequestContext.currentOrNull()` Motivation: `ServiceRequestContext.currentOrNull()` raises an `IllegalArgumentException` if the current ctx is `ClientRequestContext` and `ctx.root()` returns `null`. It's very confusing because all other APIs returns `null` if the name ends with `orNull`. So I think the API should return `null` instead of raising an exception. We could use `ClientRequestContext.roo()` to find out if the client call is invoked by a server request or not. Modification: - Returns `null` instread of raising an exception from `(Service|Client)RequestContext.currentOrNull()` Result: - `(Service|Client)RequestContext.currentOrNull()` does not throw an exception anymore. * Address the comment by @trustin
- Loading branch information
Showing
4 changed files
with
20 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters