Skip to content

Commit

Permalink
fix after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed Jan 29, 2022
1 parent c8f4ea2 commit 341ea46
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions cli/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1052,11 +1052,11 @@ These must be added to the path manually if required.")
fn jupyter_subcommand<'a>() -> App<'a> {
App::new("jupyter")
.arg(
Arg::with_name("install")
Arg::new("install")
.long("install")
)
.arg(
Arg::with_name("conn")
Arg::new("conn")
.long("conn")
.help("Path to JSON file describing connection parameters, provided by Jupyter")
.takes_value(true)
Expand Down Expand Up @@ -4727,6 +4727,7 @@ mod tests {
r.unwrap_err();
}

#[test]
fn test_config_path_args() {
let flags = flags_from_vec(svec!["deno", "run", "foo.js"]).unwrap();
assert_eq!(
Expand Down
14 changes: 7 additions & 7 deletions cli/tools/jupyter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,24 +505,24 @@ impl Kernel {
.evaluate_line_with_object_wrapping(&exec_request_content.code)
.await?;

let result = if output.value["exceptionDetails"].is_object() {
let stack_trace: Vec<String> = output.value["exceptionDetails"]
["exception"]["description"]
.as_str()
let result = if let Some(exception_details) = output.value.exception_details
{
let exception = exception_details.exception.unwrap();
let stack_trace: Vec<String> = exception
.description
.unwrap()
.split('\n')
.map(|s| s.to_string())
.collect();
ExecResult::Error(ExecError {
// TODO(apowers313) this could probably use smarter unwrapping -- for example, someone may throw non-object
err_name: output.value["exceptionDetails"]["exception"]["className"]
.to_string(),
err_name: exception.class_name.unwrap(),
err_value: stack_trace.first().unwrap().to_string(),
// output.value["exceptionDetails"]["stackTrace"]["callFrames"]
stack_trace,
})
} else {
ExecResult::Ok(output.value["result"].clone())
ExecResult::Ok(output.value.result.value.unwrap())
};

match result {
Expand Down
2 changes: 1 addition & 1 deletion runtime/js/40_jupyter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const core = window.__bootstrap.core;
const {
TypeError,
JSONStringify
JSONStringify,
} = window.__bootstrap.primordials;
const jupyter = {};

Expand Down

0 comments on commit 341ea46

Please sign in to comment.