Skip to content

Commit

Permalink
better reporting of bootstrap errors. would have prevented JuliaLang#…
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jul 30, 2012
1 parent af6e780 commit 802d65b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/julia.expmap
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@
jl_get_current_task;
jl_enter_handler;
jl_exception_in_transit;
jl_errorexception_type;
jl_loaderror_type;
jl_backtrace_type;
jl_show;
jl_show_any;
jl_print_symbol;
Expand Down
6 changes: 3 additions & 3 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,10 @@ extern jl_typename_t *jl_array_typename;
extern jl_struct_type_t *jl_weakref_type;
extern jl_struct_type_t *jl_ascii_string_type;
extern jl_struct_type_t *jl_utf8_string_type;
extern jl_struct_type_t *jl_errorexception_type;
extern DLLEXPORT jl_struct_type_t *jl_errorexception_type;
extern jl_struct_type_t *jl_typeerror_type;
extern jl_struct_type_t *jl_loaderror_type;
extern jl_struct_type_t *jl_backtrace_type;
extern DLLEXPORT jl_struct_type_t *jl_loaderror_type;
extern DLLEXPORT jl_struct_type_t *jl_backtrace_type;
extern jl_value_t *jl_stackovf_exception;
extern jl_value_t *jl_memory_exception;
extern jl_value_t *jl_divbyzero_exception;
Expand Down
21 changes: 19 additions & 2 deletions ui/repl.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,28 @@ static int exec_program(void)
//jl_lisp_prompt();
//return 1;
jl_value_t *errs = jl_stderr_obj();
jl_value_t *e = jl_exception_in_transit;
if (errs != NULL) {
jl_show(jl_stderr_obj(), jl_exception_in_transit);
jl_show(jl_stderr_obj(), e);
}
else {
ios_printf(ios_stderr, "error during bootstrap\n");
while (1) {
if (jl_typeof(e) == (jl_type_t*)jl_loaderror_type) {
e = jl_fieldref(e, 2);
// TODO: show file and line
}
else if (jl_typeof(e) == (jl_type_t*)jl_backtrace_type) {
e = jl_fieldref(e, 0);
}
else break;
}
if (jl_typeof(e) == (jl_type_t*)jl_errorexception_type) {
ios_printf(ios_stderr, "error during bootstrap: %s\n",
jl_string_data(jl_fieldref(e,0)));
}
else {
ios_printf(ios_stderr, "error during bootstrap\n");
}
}
ios_printf(ios_stderr, "\n");
JL_EH_POP();
Expand Down

0 comments on commit 802d65b

Please sign in to comment.