Skip to content
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

Introduce $kind as a pivot point for uncaught errors #254

Conversation

blast-hardcheese
Copy link

Why

$kind is emerging as a de-facto property to identify the type of a payload. Adding a literal $kind: "error" permits consumers to easily filter in/out error payloads.

What changed

Add $kind: "error" to RiverUncaughtSchema, for consumers to easily identify error payloads

Versioning

  • Breaking protocol change
  • Breaking ts/js API change

@blast-hardcheese blast-hardcheese requested a review from a team as a code owner August 14, 2024 17:28
@blast-hardcheese blast-hardcheese requested review from jackyzha0 and removed request for a team August 14, 2024 17:28
@blast-hardcheese blast-hardcheese force-pushed the dstewart/feat/communicate-uncaught-schema-structure branch 2 times, most recently from 61746cb to e160ff2 Compare August 14, 2024 17:32
Copy link
Member

@jackyzha0 jackyzha0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code already exists for this purpose, all new user defined errors also define their own code to discriminate on

https://github.com/replit/river/blob/main/router/result.ts#L14

@blast-hardcheese blast-hardcheese force-pushed the dstewart/feat/communicate-uncaught-schema-structure branch from e160ff2 to 0a8e35e Compare August 14, 2024 17:36
@blast-hardcheese
Copy link
Author

Classifiers are useful, since code idiomatically means the actual value to match on, not that the structure represents an error more broadly.

@jackyzha0
Copy link
Member

if its ok: false then its an error, is there anything else in particular you're trying to assert?

@blast-hardcheese
Copy link
Author

Ahh. The issue I was running into was that the python codegen doesn't expose ok, and the results of the client operations are just an otherwise inscrutable R | E. Bummer.

@blast-hardcheese
Copy link
Author

Alright. Going with a different approach.

@jackyzha0 jackyzha0 deleted the dstewart/feat/communicate-uncaught-schema-structure branch August 19, 2024 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants