+#[derive(Debug)]
+struct ColorError(String);
+
+impl Display for ColorError {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ write!(f, "Invalid color specification: {}", &self.0)
+ }
+}
+
+impl ResponseError for ColorError {
+ fn status_code(&self) -> StatusCode {
+ StatusCode::INTERNAL_SERVER_ERROR
+ }
+
+ fn error_response(&self) -> HttpResponse<BoxBody> {
+ HttpResponse::InternalServerError().body(format!("{}\n", &self))
+ }
+}
+