Skip to content

Commit

Permalink
Remove TODOs for typing error passed into end callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorLift committed Mar 14, 2024
1 parent bac8e0e commit b9549ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions packages/json-rpc-engine/src/JsonRpcEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,7 @@ export class JsonRpcEngine extends SafeEventEmitter {
return handlerCallback();
});
} catch (error) {
// TODO: Explicitly handle errors thrown from `#runAllMiddleware` that are not of type `JsonRpcEngineCallbackError`
return end(error as JsonRpcEngineCallbackError);
return end(error);
}
};
}
Expand Down Expand Up @@ -600,8 +599,7 @@ export class JsonRpcEngine extends SafeEventEmitter {
try {
middleware(request, response, next, end);
} catch (error) {
// TODO: Explicitly handle errors thrown from `middleware` that are not of type `JsonRpcEngineCallbackError`
end(error as JsonRpcEngineCallbackError);
end(error);
}
});
}
Expand Down
3 changes: 1 addition & 2 deletions packages/json-rpc-engine/src/createAsyncMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ export function createAsyncMiddleware<
if (returnHandlerCallback && error instanceof Error) {
(returnHandlerCallback as ReturnHandlerCallback)(error);
} else {
// TODO: Explicitly handle errors thrown from `#runReturnHandlers` that are not of type `JsonRpcEngineCallbackError`
end(error as JsonRpcEngineCallbackError);
end(error);
}
}
};
Expand Down

0 comments on commit b9549ed

Please sign in to comment.