palantir / palantir/conjure-java

failOnUnknown() should allow setting of error type

Open
#1,245 2 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.