palantir / palantir/conjure-java
failOnUnknown() should allow setting of error type
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 39
- Forks
- 49
- Avg merge
- 8h 22m
- Merged PRs (30d)
- 32
Description
What happened?
As a java service, communicating with a storage backend via conjure, I used .failOnUnknown() when writing a visitor for the response object. I dug in though and noticed this would throw an illegal-argument exception and trigger an HTTP 400 response.
What did you want to happen?
Since this would be my application complaining about an unknown type coming from an underlying service, this definitely seems like an internal server error, HTTP 500. I would like to be able to pass an ErrorType into the .failOnUnknown() method, so I can control what HTTP status it would return without an awkward try-catch structure.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the failOnUnknown() response-visitor API and trace how an unknown type becomes an IllegalArgumentException and an HTTP 400 response. Review the ErrorType API and related visitor tests or entry points; done means callers can provide an error type and the resulting HTTP status is verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100