From 90b5faea69fd4d4f53b1dadd11cf5f60baf95164 Mon Sep 17 00:00:00 2001 From: Bodo Junglas Date: Tue, 4 Dec 2018 14:07:22 +0100 Subject: [PATCH] TEAS-577 [feat] add utf8 error handling --- src/problem.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/problem.rs b/src/problem.rs index 36500ea..ff8b2c4 100644 --- a/src/problem.rs +++ b/src/problem.rs @@ -110,6 +110,14 @@ impl From for Problem { } } +impl From for Problem { + fn from(error: std::str::Utf8Error) -> Problem { + error!("UTF-8 error: {}", error); + + Problem::bad_request().with_details(format!("UTF-8 error: {}", error)) + } +} + impl From for Problem { fn from(error: actix_web::Error) -> Problem { error!("Actix: {}", error);