hs-playlib 0.5.0 → 0.7.0

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.
@@ -132,16 +132,23 @@ class UniffiClient {
132
132
  try {
133
133
  checkCallStatus(this._ffi, status);
134
134
  const bytes = liftBytes(result);
135
+ try {
136
+ const connectorReq = proto_js_1.types.FfiConnectorHttpRequest.decode(bytes);
137
+ if (connectorReq?.url || connectorReq?.method || connectorReq?.body) {
138
+ return bytes;
139
+ }
140
+ }
141
+ catch (_ignored) {
142
+ // not an HTTP request payload
143
+ }
135
144
  try {
136
145
  const reqErr = proto_js_1.types.RequestError.decode(bytes);
137
146
  if (reqErr.errorMessage) {
138
- const err = new Error(reqErr.errorMessage);
139
- err.ffiError = reqErr;
140
- throw err;
147
+ throw reqErr;
141
148
  }
142
149
  }
143
150
  catch (e) {
144
- if (e.ffiError)
151
+ if (e instanceof proto_js_1.types.RequestError)
145
152
  throw e;
146
153
  // decode failed — not an error proto, return bytes as-is
147
154
  }
@@ -171,13 +178,11 @@ class UniffiClient {
171
178
  try {
172
179
  const resErr = proto_js_1.types.ResponseError.decode(bytes);
173
180
  if (resErr.errorMessage) {
174
- const err = new Error(resErr.errorMessage);
175
- err.ffiError = resErr;
176
- throw err;
181
+ throw resErr;
177
182
  }
178
183
  }
179
184
  catch (e) {
180
- if (e.ffiError)
185
+ if (e instanceof proto_js_1.types.ResponseError)
181
186
  throw e;
182
187
  // decode failed — not an error proto, return bytes as-is
183
188
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hs-playlib",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Hyperswitch Payments SDK — Node.js client for connector integrations via UniFFI FFI",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -26,4 +26,4 @@
26
26
  "tsconfig-paths": "^4.2.0",
27
27
  "typescript": "^5.9.3"
28
28
  }
29
- }
29
+ }