| | | 1 | | namespace Envilder; |
| | | 2 | | |
| | | 3 | | using System; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Thrown when an AWS request fails because the credentials or security token |
| | | 7 | | /// are expired or invalid (for example, an expired SSO session). |
| | | 8 | | /// </summary> |
| | | 9 | | public class ExpiredCredentialsException : Exception |
| | | 10 | | { |
| | | 11 | | private const string RemediationMessage = |
| | | 12 | | "AWS credentials are expired or invalid. Your security token or SSO " + |
| | | 13 | | "session may have expired. Refresh your credentials and retry " + |
| | | 14 | | "(for SSO, run: aws sso login)."; |
| | | 15 | | |
| | | 16 | | /// <summary>Initializes a new instance with the default remediation message.</summary> |
| | | 17 | | public ExpiredCredentialsException() |
| | 0 | 18 | | : base(RemediationMessage) |
| | | 19 | | { |
| | 0 | 20 | | } |
| | | 21 | | |
| | | 22 | | /// <summary>Initializes a new instance with a custom message.</summary> |
| | | 23 | | /// <param name="message">The error message.</param> |
| | | 24 | | public ExpiredCredentialsException(string message) |
| | 0 | 25 | | : base(message) |
| | | 26 | | { |
| | 0 | 27 | | } |
| | | 28 | | |
| | | 29 | | /// <summary>Initializes a new instance wrapping the underlying AWS exception.</summary> |
| | | 30 | | /// <param name="innerException">The original AWS SDK exception.</param> |
| | | 31 | | public ExpiredCredentialsException(Exception innerException) |
| | 1 | 32 | | : base(RemediationMessage, innerException) |
| | | 33 | | { |
| | 1 | 34 | | } |
| | | 35 | | |
| | | 36 | | /// <summary>Initializes a new instance with a custom message and inner exception.</summary> |
| | | 37 | | /// <param name="message">The error message.</param> |
| | | 38 | | /// <param name="innerException">The original AWS SDK exception.</param> |
| | | 39 | | public ExpiredCredentialsException(string message, Exception innerException) |
| | 0 | 40 | | : base(message, innerException) |
| | | 41 | | { |
| | 0 | 42 | | } |
| | | 43 | | } |