From 168032d442ec2e79a425077d0b97bac4e7e00b61 Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Thu, 24 Oct 2024 11:55:52 +0700 Subject: [PATCH] refactor: throw RPCError with original error --- .../dapi/lib/externalApis/tenderdash/requestTenderRpc.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/dapi/lib/externalApis/tenderdash/requestTenderRpc.js b/packages/dapi/lib/externalApis/tenderdash/requestTenderRpc.js index 15997ee95c..efdec5962f 100644 --- a/packages/dapi/lib/externalApis/tenderdash/requestTenderRpc.js +++ b/packages/dapi/lib/externalApis/tenderdash/requestTenderRpc.js @@ -23,9 +23,11 @@ function requestTenderRpcFactory(rpcClient) { throw new UnavailableGrpcError('Tenderdash is not available'); } - e.message = `Failed to request ${uri}: ${e.message}`; - - throw e; + throw new RPCError( + e.code || -32602, + `Failed to request ${uri}: ${e.message}`, + e, + ); } const { result, error: jsonRpcError } = response;