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

34 lines 1.38 kB
/** * Thrown when the AWS SSO session for the active profile could not be loaded * or has expired, so credentials cannot be resolved. */ export class SsoSessionExpiredError extends Error { constructor(profileName, cause) { super(SsoSessionExpiredError.buildMessage(profileName)); this.name = 'SsoSessionExpiredError'; this.profileName = profileName; this.cause = cause; } static buildMessage(profileName) { if (profileName) { return (`Your AWS SSO session for profile '${profileName}' could not be ` + `loaded or has expired. Run: aws sso login --profile ${profileName} ` + 'and then re-run this command.'); } return ('Your AWS SSO session could not be loaded or has expired. Run: ' + 'aws sso login and then re-run this command.'); } } const SSO_SESSION_EXPIRED_ERROR_NAMES = new Set(['TokenProviderError']); /** * Detects whether an unknown error represents an expired or unresolved AWS SSO * session, by inspecting its AWS error name. */ export function isSsoSessionExpiredError(error) { if (typeof error !== 'object' || error === null || !('name' in error)) { return false; } const name = String(error.name); return SSO_SESSION_EXPIRED_ERROR_NAMES.has(name); } //# sourceMappingURL=sso-session-expired-error.js.map