summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgewoonwoutje <gewoonwoutje@users.noreply.github.com>2020-04-11 04:14:16 +0200
committerGitHub <noreply@github.com>2020-04-10 22:14:16 -0400
commit2feb661b858f3c8380ceb0362d137079e12b9248 (patch)
tree2a663ed800f7e2d29f2ea573a92d297434c1f9d4
parent3e51e67f8ad4dddc754e9906f55306b0965a73f7 (diff)
Replace panic with invalid_utf8 OpError (#4704)
Co-authored-by: Wout Elstgeest <w.elstgeest@inepro.com>
-rw-r--r--cli/ops/compiler.rs3
1 files changed, 2 insertions, 1 deletions
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(),