Fixed consistency issues with default ex handler

Previously there was a difference between how the default handler displayed objects compared to custom exception handlers. This has been fixed up so all error objects are displayed consistently.
This commit is contained in:
Justin Ethier 2015-06-12 21:15:07 -04:00
parent 1e5d16de25
commit a18f1923f6

View file

@ -166,11 +166,20 @@ object Cyc_glo_eval = nil;
object Cyc_exception_handler_stack = nil; object Cyc_exception_handler_stack = nil;
object Cyc_default_exception_handler(int argc, closure _, object err) { object Cyc_default_exception_handler(int argc, closure _, object err) {
printf("Error: "); fprintf(stderr, "Error: ");
// TODO: error should be a list of form (type arg1 ... argn)
// want to ignore type and display args without enclosing parens if (nullp(err) || is_value_type(err) || type_of(err) != cons_tag) {
Cyc_display_va(1, err); Cyc_display(err, stderr);
printf("\n"); } else {
// Error is list of form (type arg1 ... argn)
err = cdr(err); // skip type field
for (; !nullp(err); err = cdr(err)){ // output with no enclosing parens
Cyc_display(car(err), stderr);
fprintf(stderr, " ");
}
}
fprintf(stderr, "\n");
exit(1); exit(1);
return nil; return nil;
} }