Skip to content

Commit

Permalink
Revert "Revert json ops (denoland#2814)"
Browse files Browse the repository at this point in the history
This reverts commit 2235dd7.
  • Loading branch information
bartlomieju committed Aug 25, 2019
1 parent 2235dd7 commit 641a537
Show file tree
Hide file tree
Showing 45 changed files with 1,055 additions and 1,978 deletions.
17 changes: 17 additions & 0 deletions cli/deno_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ impl GetErrorKind for ReadlineError {
}
}

impl GetErrorKind for serde_json::error::Error {
fn kind(&self) -> ErrorKind {
use serde_json::error::*;
match self.classify() {
Category::Io => ErrorKind::InvalidInput,
Category::Syntax => ErrorKind::InvalidInput,
Category::Data => ErrorKind::InvalidData,
Category::Eof => ErrorKind::UnexpectedEof,
}
}
}

#[cfg(unix)]
mod unix {
use super::{ErrorKind, GetErrorKind};
Expand Down Expand Up @@ -251,6 +263,11 @@ impl GetErrorKind for dyn AnyError {
.or_else(|| self.downcast_ref::<uri::InvalidUri>().map(Get::kind))
.or_else(|| self.downcast_ref::<url::ParseError>().map(Get::kind))
.or_else(|| self.downcast_ref::<ReadlineError>().map(Get::kind))
.or_else(|| {
self
.downcast_ref::<serde_json::error::Error>()
.map(Get::kind)
})
.or_else(|| unix_error_kind(self))
.unwrap_or_else(|| {
panic!("Can't get ErrorKind for {:?}", self);
Expand Down
1 change: 0 additions & 1 deletion cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ mod http_body;
mod http_util;
mod import_map;
pub mod msg;
pub mod msg_util;
pub mod ops;
pub mod permissions;
mod progress;
Expand Down
Loading

0 comments on commit 641a537

Please sign in to comment.