summaryrefslogtreecommitdiff
path: root/ext/ffi/lib.rs
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2021-10-07 20:33:00 +0530
committerGitHub <noreply@github.com>2021-10-07 11:03:00 -0400
commitab2e0a465e4eafe4de2cc6ac7ef61d1655db4c2d (patch)
tree4d7cf0aaf61e7c398f820d1d31b519c0eb1d9883 /ext/ffi/lib.rs
parent822047b845d083721eb22663c98692d341bde648 (diff)
fix(ext/ffi): don't panic in dlopen (#12344)
Diffstat (limited to 'ext/ffi/lib.rs')
-rw-r--r--ext/ffi/lib.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/ffi/lib.rs b/ext/ffi/lib.rs
index b5505fb0c..d2b0d24df 100644
--- a/ext/ffi/lib.rs
+++ b/ext/ffi/lib.rs
@@ -1,6 +1,5 @@
// Copyright 2021 the Deno authors. All rights reserved. MIT license.
-use deno_core::error::anyhow;
use deno_core::error::bad_resource_id;
use deno_core::error::AnyError;
use deno_core::include_js_files;
@@ -370,7 +369,12 @@ where
let permissions = state.borrow_mut::<FP>();
permissions.check(&path)?;
- let lib = Library::open(&path).map_err(|e| anyhow!(format_error(e, path)))?;
+ let lib = Library::open(&path).map_err(|e| {
+ dlopen::Error::OpeningLibraryError(std::io::Error::new(
+ std::io::ErrorKind::Other,
+ format_error(e, path),
+ ))
+ })?;
let mut resource = DynamicLibraryResource {
lib,