@stackwright-pro/auth 0.2.0-alpha.3 → 0.2.0-alpha.4

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.mjs CHANGED
@@ -388,7 +388,7 @@ async function discoverOIDC(discoveryUrl) {
388
388
  return metadata;
389
389
  } catch (error) {
390
390
  if (error instanceof Error && error.name === "AbortError") {
391
- throw new Error(`OIDC request timed out after 10s: ${discoveryUrl}`);
391
+ throw new Error(`OIDC request timed out after 10s: ${discoveryUrl}`, { cause: error });
392
392
  }
393
393
  throw error;
394
394
  } finally {
@@ -450,7 +450,9 @@ async function exchangeCodeForTokens(metadata, code, clientId, clientSecret, red
450
450
  return await response.json();
451
451
  } catch (error) {
452
452
  if (error instanceof Error && error.name === "AbortError") {
453
- throw new Error(`OIDC request timed out after 10s: ${metadata.token_endpoint}`);
453
+ throw new Error(`OIDC request timed out after 10s: ${metadata.token_endpoint}`, {
454
+ cause: error
455
+ });
454
456
  }
455
457
  throw error;
456
458
  } finally {
@@ -482,7 +484,9 @@ async function refreshAccessToken(metadata, refreshToken, clientId, clientSecret
482
484
  return await response.json();
483
485
  } catch (error) {
484
486
  if (error instanceof Error && error.name === "AbortError") {
485
- throw new Error(`OIDC request timed out after 10s: ${metadata.token_endpoint}`);
487
+ throw new Error(`OIDC request timed out after 10s: ${metadata.token_endpoint}`, {
488
+ cause: error
489
+ });
486
490
  }
487
491
  throw error;
488
492
  } finally {