pub async fn write_json_error( session: &mut Session, status: u16, error: &str, message: Option<&str>, ) -> Result<(), Box<Error>>
Write a JSON error response
Creates a JSON object with error and optional message fields.
error
message
// Produces: {"error":"not_found","message":"Resource does not exist"} write_json_error(session, 404, "not_found", Some("Resource does not exist")).await?;