@vritti/api-sdk 0.2.8 → 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.cjs CHANGED
@@ -5115,7 +5115,11 @@ var HttpLoggerInterceptor = class {
5115
5115
  const correlationContext = getCorrelationContext();
5116
5116
  const err = error;
5117
5117
  const statusCode = err.status ?? err.statusCode ?? response.statusCode ?? 500;
5118
- const errorMessage = err.message || err.detail || "Unknown error";
5118
+ const pgCause = findPgError(error);
5119
+ let errorMessage = err.message || err.detail || "Unknown error";
5120
+ if (pgCause?.message && pgCause.message !== err.message) {
5121
+ errorMessage = `${errorMessage} \u2014 cause: ${pgCause.message}${pgCause.code ? ` [${pgCause.code}]` : ""}`;
5122
+ }
5119
5123
  const metadata = {
5120
5124
  type: "http_error",
5121
5125
  method: request.method,
@@ -5126,6 +5130,9 @@ var HttpLoggerInterceptor = class {
5126
5130
  errorName: err.name || "Error",
5127
5131
  errorMessage
5128
5132
  };
5133
+ if (pgCause) {
5134
+ metadata.pgError = pgCause;
5135
+ }
5129
5136
  if (err.stack) {
5130
5137
  metadata.trace = err.stack;
5131
5138
  }