Skip to content

feat(kernel): Add Error as a possible params type of CommandReply. - #113

Merged
grypez merged 1 commit into
mainfrom
grypez/command-replies-can-return-errors
Sep 30, 2024
Merged

feat(kernel): Add Error as a possible params type of CommandReply.#113
grypez merged 1 commit into
mainfrom
grypez/command-replies-can-return-errors

Conversation

@grypez

Copy link
Copy Markdown
Member

It seems reasonable to me that any reply except 'pong' could be an error. Once we get custom error classes we could set the ErrorType to the appropriate union for each CommandReply element.

Changes

@ocap/kernel

  • Realizes CommandReply as a union of the new CommandReplyLike type
typeCommandReplyLike<MethodextendsCommandMethod,DataextendsCommandParams,ErrorTypeextendsError=never,>={method: Method;params: Data|ErrorType;};
  • Permits CommandMethod.KVGet to return an Error as its params

@ocap/extension

  • Introduces an asError routine to cast problems to Errors (reference)

@grypez
grypez requested a review from a team as a code ownerSeptember 28, 2024 11:23
@grypez
grypezforce-pushed the grypez/command-replies-can-return-errors branch from b77d4bd to e886d04CompareSeptember 28, 2024 11:26

@FUDCoFUDCo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ooh ooh!

@grypez
grypezforce-pushed the grypez/command-replies-can-return-errors branch from e886d04 to 7ecf5c0CompareSeptember 30, 2024 18:07
@grypez
grypez merged commit 414cbac into mainSep 30, 2024
@grypez
grypez deleted the grypez/command-replies-can-return-errors branch September 30, 2024 18:13
Sign up for freeto 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

@grypez@FUDCo