mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
Replace panic with invalid_utf8 OpError (#4704)
Co-authored-by: Wout Elstgeest <w.elstgeest@inepro.com>
This commit is contained in:
parent
3e51e67f8a
commit
2feb661b85
1 changed files with 2 additions and 1 deletions
|
@ -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(),
|
||||
|
|
Loading…
Reference in a new issue