From facf88c76345e237a76d24328183de70ad28af73 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Thu, 4 Apr 2024 14:32:40 +0100 Subject: [PATCH] Revert error handling changes --- packages/validator/src/util/externalSignerClient.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/validator/src/util/externalSignerClient.ts b/packages/validator/src/util/externalSignerClient.ts index 7cd01c81ff2..374da79b798 100644 --- a/packages/validator/src/util/externalSignerClient.ts +++ b/packages/validator/src/util/externalSignerClient.ts @@ -174,7 +174,7 @@ export async function externalSignerUpCheck(remoteUrl: string): Promise async function handleExternalSignerResponse(res: Response): Promise { if (!res.ok) { const errBody = await res.text(); - throw Error(errBody ? getErrorMessage(errBody) : res.statusText); + throw Error(errBody || res.statusText); } const contentType = res.headers.get("content-type"); @@ -194,15 +194,6 @@ async function handleExternalSignerResponse(res: Response): Promise { } } -function getErrorMessage(errBody: string): string { - try { - const errJson = JSON.parse(errBody) as {message?: string}; - return errJson.message ?? errBody; - } catch (e) { - return errBody; - } -} - function serializerSignableMessagePayload(config: BeaconConfig, payload: SignableMessage): Record { switch (payload.type) { case SignableMessageType.AGGREGATION_SLOT: