pub fn create_custom_error(
status: StatusCode,
message: impl Into<String>,
error_type: Option<String>,
include_details: bool,
) -> ErrorResponseExpand description
Creates a custom error response with a specific message and status code.
This function allows you to create custom error responses for specific error conditions in your application.
§Arguments
status- HTTP status codemessage- Error messageerror_type- Optional error type identifierinclude_details- Whether to include detailed error information
§Returns
An ErrorResponse with the specified status code and message.
§Example
use streamweave::http_server::error::create_custom_error;
use axum::http::StatusCode;
let error = create_custom_error(
StatusCode::BAD_REQUEST,
"Invalid user ID format",
Some("InvalidUserIdError".to_string()),
false,
);