Skip to content

Commit

Permalink
improve error serialization in rpc logs (backport #7216) [release/4.9…
Browse files Browse the repository at this point in the history
….x] (#7217)

Co-authored-by: Paulius Valiūnas <[email protected]>
  • Loading branch information
mergify[bot] and paulius-valiunas authored Oct 1, 2024
1 parent 8e930cc commit 651e6e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-backend",
"comment": "",
"type": "none"
}
],
"packageName": "@itwin/core-backend"
}
4 changes: 2 additions & 2 deletions core/backend/src/rpc/web/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @module RpcInterface
*/

import { Logger } from "@itwin/core-bentley";
import { BentleyError, Logger } from "@itwin/core-bentley";
import {
CommonLoggerCategory,
HttpServerRequest,
Expand Down Expand Up @@ -157,7 +157,7 @@ function logResponse(request: SerializedRpcRequest, statusCode: number, resultOb
path: request.path,
operation: request.operation,
statusCode,
errorObj: resultObj instanceof Error ? resultObj : undefined,
errorObj: resultObj instanceof Error ? BentleyError.getErrorProps(resultObj) : undefined,
};

if (statusCode < 400)
Expand Down

0 comments on commit 651e6e7

Please sign in to comment.