From b9549ed4806d47c04076969d8d87ea997d6d1730 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 14 Mar 2024 16:16:30 -0400 Subject: [PATCH] Remove TODOs for typing `error` passed into `end` callbacks --- packages/json-rpc-engine/src/JsonRpcEngine.ts | 6 ++---- packages/json-rpc-engine/src/createAsyncMiddleware.ts | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/json-rpc-engine/src/JsonRpcEngine.ts b/packages/json-rpc-engine/src/JsonRpcEngine.ts index bf4beaf32b..3cc4fbbd4f 100644 --- a/packages/json-rpc-engine/src/JsonRpcEngine.ts +++ b/packages/json-rpc-engine/src/JsonRpcEngine.ts @@ -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); } }; } @@ -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); } }); } diff --git a/packages/json-rpc-engine/src/createAsyncMiddleware.ts b/packages/json-rpc-engine/src/createAsyncMiddleware.ts index 084190959e..a24b607e4a 100644 --- a/packages/json-rpc-engine/src/createAsyncMiddleware.ts +++ b/packages/json-rpc-engine/src/createAsyncMiddleware.ts @@ -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); } } };