@mitumba/sdk 5.17.0 → 5.17.1

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
@@ -293,7 +293,13 @@ var APIClient = class {
293
293
  */
294
294
  async send(method, path, body, params, options) {
295
295
  if (!isSessionEndpoint(path)) {
296
- await this.ensureFreshToken(options);
296
+ try {
297
+ await this.ensureFreshToken(options);
298
+ } catch (error) {
299
+ if (!(error instanceof InvalidRefreshCredentialsError)) throw error;
300
+ this.config.onAuthExpired?.();
301
+ throw new APIError(401, { error: "session_expired", message: "Session expired. Please log in again." });
302
+ }
297
303
  }
298
304
  const url = new URL(path, this.config.baseUrl);
299
305
  if (params) {