UNPKG

envilder

Version:

A CLI and GitHub Action that securely centralizes your environment variables from AWS SSM or Azure Key Vault as a single source of truth

29 lines 1.05 kB
/** * Thrown when an AWS request fails because the credentials or security token * are expired or invalid (for example, an expired SSO session). */ export class ExpiredCredentialsError extends Error { constructor(cause) { super('AWS credentials are expired or invalid. Your security token or SSO ' + 'session may have expired. Refresh your credentials and retry ' + '(for SSO, run: aws sso login).'); this.name = 'ExpiredCredentialsError'; this.cause = cause; } } const EXPIRED_CREDENTIAL_ERROR_NAMES = new Set([ 'ExpiredToken', 'ExpiredTokenException', ]); /** * Detects whether an unknown error represents expired or invalid AWS * credentials, by inspecting its AWS error name. */ export function isExpiredCredentialsError(error) { if (typeof error !== 'object' || error === null || !('name' in error)) { return false; } const name = String(error.name); return EXPIRED_CREDENTIAL_ERROR_NAMES.has(name); } //# sourceMappingURL=expired-credentials-error.js.map