Skip to content

Commit

Permalink
refactor dispatch take 2 (denoland#2533)
Browse files Browse the repository at this point in the history
  • Loading branch information
afinch7 authored and ry committed Jun 18, 2019
1 parent 9ad5b06 commit 76d51b0
Show file tree
Hide file tree
Showing 8 changed files with 470 additions and 497 deletions.
3 changes: 2 additions & 1 deletion cli/dispatch_minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//! message or a "minimal" message.
use crate::state::ThreadSafeState;
use deno::Buf;
use deno::CoreOp;
use deno::Op;
use deno::PinnedBuf;
use futures::Future;
Expand Down Expand Up @@ -89,7 +90,7 @@ pub fn dispatch_minimal(
state: &ThreadSafeState,
mut record: Record,
zero_copy: Option<PinnedBuf>,
) -> Op {
) -> CoreOp {
let is_sync = record.promise_id == 0;
let min_op = match record.op_id {
OP_READ => ops::read(record.arg, zero_copy),
Expand Down
14 changes: 14 additions & 0 deletions cli/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,20 @@ pub fn no_buffer_specified() -> DenoError {
new(ErrorKind::InvalidInput, String::from("no buffer specified"))
}

pub fn no_async_support() -> DenoError {
new(
ErrorKind::NoAsyncSupport,
String::from("op doesn't support async calls"),
)
}

pub fn no_sync_support() -> DenoError {
new(
ErrorKind::NoSyncSupport,
String::from("op doesn't support sync calls"),
)
}

#[derive(Debug)]
pub enum RustOrJsError {
Rust(DenoError),
Expand Down
2 changes: 2 additions & 0 deletions cli/msg.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ enum ErrorKind: byte {
OpNotAvaiable,
WorkerInitFailed,
UnixError,
NoAsyncSupport,
NoSyncSupport,
ImportMapError,
}

Expand Down
Loading

0 comments on commit 76d51b0

Please sign in to comment.