@vritti/api-sdk 0.2.9 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5000,7 +5000,11 @@ var HttpLoggerInterceptor = class {
5000
5000
  const correlationContext = getCorrelationContext();
5001
5001
  const err = error;
5002
5002
  const statusCode = err.status ?? err.statusCode ?? response.statusCode ?? 500;
5003
- const errorMessage = err.message || err.detail || "Unknown error";
5003
+ const pgCause = findPgError(error);
5004
+ let errorMessage = err.message || err.detail || "Unknown error";
5005
+ if (pgCause?.message && pgCause.message !== err.message) {
5006
+ errorMessage = `${errorMessage} \u2014 cause: ${pgCause.message}${pgCause.code ? ` [${pgCause.code}]` : ""}`;
5007
+ }
5004
5008
  const metadata = {
5005
5009
  type: "http_error",
5006
5010
  method: request.method,
@@ -5011,6 +5015,9 @@ var HttpLoggerInterceptor = class {
5011
5015
  errorName: err.name || "Error",
5012
5016
  errorMessage
5013
5017
  };
5018
+ if (pgCause) {
5019
+ metadata.pgError = pgCause;
5020
+ }
5014
5021
  if (err.stack) {
5015
5022
  metadata.trace = err.stack;
5016
5023
  }