Skip to main content

awsim_lambda/
error.rs

1use awsim_core::AwsError;
2
3pub fn resource_not_found(resource_type: &str, name: &str) -> AwsError {
4    AwsError::not_found(
5        "ResourceNotFoundException",
6        format!("Function not found: {resource_type} {name}"),
7    )
8}
9
10pub fn resource_conflict(message: impl Into<String>) -> AwsError {
11    AwsError::conflict("ResourceConflictException", message)
12}
13
14pub fn invalid_parameter(message: impl Into<String>) -> AwsError {
15    AwsError::bad_request("InvalidParameterValueException", message)
16}
17
18pub fn missing_parameter(param: &str) -> AwsError {
19    AwsError::bad_request(
20        "InvalidParameterValueException",
21        format!("The request must contain the parameter {param}"),
22    )
23}