Skip to content

Commit 31df859

Browse files
committed
more context in json-rpc errors
1 parent 44d02b6 commit 31df859

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/json-rpc/polkadot/chain-head/header.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ export const chainHead_v1_header = (
4444
);
4545
}
4646
} else {
47-
logger.error(`Error response for ${keyOf(req)}`);
47+
logger.error("Error response for {key} {method}: {res}", {
48+
key: keyOf(req),
49+
method: req.method,
50+
res,
51+
});
4852
}
4953
},
5054
});

src/json-rpc/polkadot/chain-head/ops/handler.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ const forwardHandler = ({
5757
return forwardChainHeadHandler({
5858
afterResponse: (req, res, { upstream, upstreamSubId, downstream }) => {
5959
if (!isSuccess(res)) {
60-
logger.error(`Error response for ${req.id}`);
60+
logger.error("Error response for {id} {method}: {res}", {
61+
id: req.id,
62+
method: req.method,
63+
res,
64+
});
6165
return;
6266
}
6367

@@ -202,7 +206,11 @@ const forwardWithCacheHandler = ({
202206
const localId = req.params[0];
203207

204208
if (!isSuccess(res)) {
205-
logger.error(`Error response for ${keyOf(req)}`);
209+
logger.error("Error response for {key} {method}: {res}", {
210+
key: keyOf(req),
211+
method: req.method,
212+
res,
213+
});
206214
return;
207215
}
208216

0 commit comments

Comments
 (0)