Opened 6 years ago
Last modified 6 years ago
#15902 new defect
catch maxima RuntimeErrors and rethrow usefully
Reported by: | rws | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-6.4 |
Component: | interfaces | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
In calculus/calculus.py
: symbolic_expression_from_maxima_string()
should catch maxima RuntimeError
s from ecl.c
and rethrow them with meaningful information, like the statement triggering the error and, if possible, the exact maxima error msg.
At the moment you only get RuntimeError: ECL says: THROW: The catch MACSYMA-QUIT is undefined.
(don't know if the latter is possible)
Change History (3)
comment:1 Changed 6 years ago by
comment:2 Changed 6 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:3 Changed 6 years ago by
- Milestone changed from sage-6.3 to sage-6.4
Note: See
TracTickets for help on using
tickets.
There may be several ways of approaching this problem. The main reason why this runtime error occurs is illustrated by:
The problem is that
maxima_eval
itself is a wrapper around a lisp function. When called with a string argument, the default is to convert that string to a lisp expression via the lisp "reader" (think parser). The"#$...$"
construct is a reader "macro": it calls the maxima parser on the string. Problem is, this happens beforemaxima_eval
takes control (which does set up the appropriate error catching infrastructure for maxima code).We could run the reader under the same error catching:
As you can see, now the error does get processed in a different way. No useful error message comes out of it, though.
When I wrote this, it was really with the idea that it would be an error of the calculus library if maxima were fed a syntax error. Nearly all the translation between sage and maxima can be done on a deeper level than string back-and-forth parsing. See
sr_to_max
andmax_to_sr
and how they are used insr_integral
,sr_limit
andsr_sum
. It was originally the idea that the calculus-to-maxima_lib interface would eventually almost do away completely with string passing. As it turned out, this hasn't been such a priority.In my opinion,
symbolic_expression_from_maxima_string
should only receive strings that parse in maxima. Only the ones that don't give the incomprehensible error messages. Actual runtime errors are caught in a meaningful way: