UNPKG

@cloud-copilot/iam-collect

Version:

Collect IAM information from AWS Accounts

32 lines 1.22 kB
/** * Custom exception for indicating that a resource was not found * Compatible with AWS SDK error structure and can be caught by runAndCatch404 */ export class ResourceNotFoundException extends Error { constructor(message, requestId) { super(message); this.name = 'ResourceNotFoundException'; // Set up metadata to match AWS SDK error structure this.$metadata = { httpStatusCode: 404, requestId: requestId || `custom-client-${Date.now()}`, attempts: 1, totalRetryDelay: 0 }; // Ensure proper prototype chain for instanceof checks Object.setPrototypeOf(this, ResourceNotFoundException.prototype); } /** * Create a ResourceNotFoundException for a missing resource */ static forResource(resourceType, identifier, requestId) { return new ResourceNotFoundException(`${resourceType} '${identifier}' does not exist`, requestId); } /** * Create a ResourceNotFoundException with a custom message */ static withMessage(message, requestId) { return new ResourceNotFoundException(message, requestId); } } //# sourceMappingURL=ResourceNotFoundException.js.map