@cloud-copilot/iam-collect
Version:
Collect IAM information from AWS Accounts
37 lines • 1.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResourceNotFoundException = void 0;
/**
* Custom exception for indicating that a resource was not found
* Compatible with AWS SDK error structure and can be caught by runAndCatch404
*/
class ResourceNotFoundException extends Error {
name = 'ResourceNotFoundException';
$metadata;
constructor(message, requestId) {
super(message);
// 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);
}
}
exports.ResourceNotFoundException = ResourceNotFoundException;
//# sourceMappingURL=ResourceNotFoundException.js.map