diff options
author | Bert Belder <bertbelder@gmail.com> | 2020-09-14 18:48:57 +0200 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2020-09-15 01:50:52 +0200 |
commit | f5b40c918c7d602827622d167728a3e7bae87d9d (patch) | |
tree | fb51722e043f4d6bce64a2c7e897cce4ead06c82 /cli/ops/idna.rs | |
parent | 3da20d19a14ab6838897d281f1b11e49d68bd1a7 (diff) |
refactor: use the 'anyhow' crate instead of 'ErrBox' (#7476)
Diffstat (limited to 'cli/ops/idna.rs')
-rw-r--r-- | cli/ops/idna.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cli/ops/idna.rs b/cli/ops/idna.rs index 7a83f169d..60812015f 100644 --- a/cli/ops/idna.rs +++ b/cli/ops/idna.rs @@ -2,7 +2,8 @@ //! https://url.spec.whatwg.org/#idna -use deno_core::ErrBox; +use deno_core::error::uri_error; +use deno_core::error::AnyError; use deno_core::ZeroCopyBuf; use idna::domain_to_ascii; use idna::domain_to_ascii_strict; @@ -24,7 +25,7 @@ fn op_domain_to_ascii( _state: &mut deno_core::OpState, args: Value, _zero_copy: &mut [ZeroCopyBuf], -) -> Result<Value, ErrBox> { +) -> Result<Value, AnyError> { let args: DomainToAscii = serde_json::from_value(args)?; if args.be_strict { domain_to_ascii_strict(args.domain.as_str()) @@ -33,7 +34,7 @@ fn op_domain_to_ascii( } .map_err(|err| { let message = format!("Invalid IDNA encoded domain name: {:?}", err); - ErrBox::new("URIError", message) + uri_error(message) }) .map(|domain| json!(domain)) } |