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

fix: drop error boolean on server errors #293

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/interface/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,6 @@ export type ExecuteInvocation<
export interface Failure extends Error {}

export interface HandlerNotFound extends RangeError {
error: true
capability: Capability
name: 'HandlerNotFound'
}
Expand Down
8 changes: 0 additions & 8 deletions packages/server/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ export class HandlerNotFound extends RangeError {
*/
constructor(capability) {
super()
/** @type {true} */
this.error = true
this.capability = capability
}
/** @type {'HandlerNotFound'} */
Expand All @@ -183,7 +181,6 @@ export class HandlerNotFound extends RangeError {
toJSON() {
return {
name: this.name,
error: this.error,
capability: {
can: this.capability.can,
with: this.capability.with,
Expand All @@ -203,8 +200,6 @@ class HandlerExecutionError extends Failure {
super()
this.capability = capability
this.cause = cause
/** @type { true } */
this.error = true
}

/** @type {'HandlerExecutionError'} */
Expand All @@ -217,7 +212,6 @@ class HandlerExecutionError extends Failure {
toJSON() {
return {
name: this.name,
error: this.error,
capability: {
can: this.capability.can,
with: this.capability.with,
Expand All @@ -241,7 +235,6 @@ class InvocationCapabilityError extends Error {
constructor(caps) {
super()
/** @type {true} */
this.error = true
this.caps = caps
}
get name() {
Expand All @@ -253,7 +246,6 @@ class InvocationCapabilityError extends Error {
toJSON() {
return {
name: this.name,
error: this.error,
message: this.message,
capabilities: this.caps,
}
Expand Down
3 changes: 0 additions & 3 deletions packages/server/test/server.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ test('unknown handler', async () => {
assert.containSubset(error, {
out: {
error: {
error: true,
name: 'HandlerNotFound',
message: `service does not implement {can: "access/register"} handler`,
capability: {
Expand All @@ -230,7 +229,6 @@ test('unknown handler', async () => {
assert.containSubset(error2, {
out: {
error: {
error: true,
name: 'HandlerNotFound',
message: `service does not implement {can: "test/boom"} handler`,
capability: {
Expand Down Expand Up @@ -279,7 +277,6 @@ test('execution error', async () => {
issuer: w3.verifier,
out: {
error: {
error: true,
name: 'HandlerExecutionError',
message: `service handler {can: "test/boom"} error: Boom`,
capability: {
Expand Down