@stackwright-pro/auth 0.2.0-alpha.2 → 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.js CHANGED
@@ -411,7 +411,7 @@ async function discoverOIDC(discoveryUrl) {
411
411
  return metadata;
412
412
  } catch (error) {
413
413
  if (error instanceof Error && error.name === "AbortError") {
414
- throw new Error(`OIDC request timed out after 10s: ${discoveryUrl}`);
414
+ throw new Error(`OIDC request timed out after 10s: ${discoveryUrl}`, { cause: error });
415
415
  }
416
416
  throw error;
417
417
  } finally {
@@ -473,7 +473,9 @@ async function exchangeCodeForTokens(metadata, code, clientId, clientSecret, red
473
473
  return await response.json();
474
474
  } catch (error) {
475
475
  if (error instanceof Error && error.name === "AbortError") {
476
- throw new Error(`OIDC request timed out after 10s: ${metadata.token_endpoint}`);
476
+ throw new Error(`OIDC request timed out after 10s: ${metadata.token_endpoint}`, {
477
+ cause: error
478
+ });
477
479
  }
478
480
  throw error;
479
481
  } finally {
@@ -505,7 +507,9 @@ async function refreshAccessToken(metadata, refreshToken, clientId, clientSecret
505
507
  return await response.json();
506
508
  } catch (error) {
507
509
  if (error instanceof Error && error.name === "AbortError") {
508
- throw new Error(`OIDC request timed out after 10s: ${metadata.token_endpoint}`);
510
+ throw new Error(`OIDC request timed out after 10s: ${metadata.token_endpoint}`, {
511
+ cause: error
512
+ });
509
513
  }
510
514
  throw error;
511
515
  } finally {