From 2feb661b858f3c8380ceb0362d137079e12b9248 Mon Sep 17 00:00:00 2001 From: gewoonwoutje Date: Sat, 11 Apr 2020 04:14:16 +0200 Subject: Replace panic with invalid_utf8 OpError (#4704) Co-authored-by: Wout Elstgeest --- cli/ops/compiler.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cli') diff --git a/cli/ops/compiler.rs b/cli/ops/compiler.rs index baa7b4c1c..37e6bfd28 100644 --- a/cli/ops/compiler.rs +++ b/cli/ops/compiler.rs @@ -156,7 +156,8 @@ fn op_fetch_source_files( .map_err(|e| OpError::other(e.to_string()))? .code } - _ => String::from_utf8(file.source_code).unwrap(), + _ => String::from_utf8(file.source_code) + .map_err(|_| OpError::invalid_utf8())?, }; Ok::<_, OpError>(json!({ "url": file.url.to_string(), -- cgit v1.2.3