Clean up internal errors

Bug #534165 reported by Matt Giuca
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mars
Fix Released
Medium
Matt Giuca

Bug Description

Internal errors in Mars are currently quite horrible. They shouldn't happen at all, but since this is an early project, they tend to happen a lot. So they should be a lot more graceful than they currently are.

- Some code calls require.error/1, which raises a software_error (this is preferred). This includes all of the Mercury standard library, which we occasionally get errors from as well.
- Some code calls exception.throw/1, usually with a string. This is bad -- you shouldn't throw string exceptions. Replace all of these with calls to require.error/1.
- Exceptions are caught and rethrown several times (depending on where they are thrown from). Exceptions are rethrown with exception.throw/1, which wraps them in a univ_cons, rather than exception.rethrow/1, which preserves their original type. This causes ugly errors to be printed with lots of univ_conses and then a big string literal, whereas a software_error prints nicely. Find all rethrow points and use exception.rethrow/1 instead.
- Exceptions at the top level are caught and displayed specially by us if they are context.errors, but otherwise propagate to the top. The only other exceptions should be software_error, which are handled well by Mercury, but we should handle them better. Catch, reprint, and display the text "This error indicates a bug in Mars. Please report it (https://bugs.launchpad.net/mars/+filebug)."
- Handle software errors in the interactive prompt without crashing the entire program (print the error and continue the interactive session).

Related branches

Revision history for this message
Matt Giuca (mgiuca) wrote :

Rethrow points are:
- mars.m: main
- marsc.m: main
- interactive.m: prompts_st, do_user_command, exec_stmt_internal

description: updated
Revision history for this message
Matt Giuca (mgiuca) wrote :

Fixed in trunk r995, 996, 998, 999 and 1000.

Changed in mars:
status: Triaged → Fix Committed
Matt Giuca (mgiuca)
Changed in mars:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.