palantir / palantir/conjure-java

Provide way for publishing errors and allowing clients to deserialize them

Open
#629 1 comment 2 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?

Currently, it's a pain for a service high-level-foo to propagate RemoteExceptions coming from another service low-level-foo to its own clients (they have to deserialize the RemoteException, then turn it into a ServiceException and throw that, otherwise RemoteExceptions always map to 500).

A big challenge here lies in having to manually pick out the right arguments by name from the RemoteException, with no error occurring if mistakes were made.

What did you want to happen?

Would be good for services that throw conjure exceptions to

  1. publish the arguments of those exceptions as a (conjure) object that has a clear structure
  2. provide a way to parse a RemoteException into a given error defined in the API that you consume

Then, the high-level-foo service maintainer can just attempt to convert the RemoteException into one or more "expected" exceptions, and handle each one in a type safe way.

This probably requires conjure-backcompat to enforce backcompat on the arguments defined for each error code, such that renaming an error would be an API break, and so would removing / renaming previously declared arguments of that error.

cc @JiahuiJiang

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 by tracing RemoteException handling and the generated conjure exception representations described in the issue. Determine how exception arguments are currently exposed and converted across service boundaries, then define the API and compatibility checks needed for typed deserialization. Done means clients can publish structured exception arguments and safely parse expected errors without manual argument lookup.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.