Project

General

Profile

Feature #743

Better errors: give supplementary info about the error

Added by John Abbott almost 9 years ago. Updated about 1 month ago.

Status:
In Progress
Priority:
Urgent
Assignee:
-
Category:
Improving
Target version:
Start date:
30 Jun 2015
Due date:
% Done:

10%

Estimated time:
Spent time:

Description

When CoCoALib produces an error which is then caught by CoCoA-5, the only information from the error which is shown to the user is the main message (e.g. Bad Arg) which can sometimes be not so helpful.

The idea is to have an optional supplementary message giving some more information (which is also displayed to the CoCoA-5 user).

We are also planning to simplify the types of error CoCoALib can produce, so that some "slight distinctions" between existing errors will be lost -- these distinctions can be recovered through the supplementary message.


Related issues

Related to CoCoALib - Feature #385: Design new errors using inheritanceIn Progress2013-07-08

Related to CoCoALib - Feature #92: Error CodesIn Progress2012-02-14

Related to CoCoALib - Design #427: Error names and error messages (current design)In Progress2014-01-28

Related to CoCoA-5 - Feature #1045: Error message from cocoalib to cocoa-5Closed2017-04-13

Related to CoCoA-5 - Bug #1622: BuiltinOneLiners -- less precise location in error messagesNew2021-10-18

Related to CoCoALib - Design #1098: Ctors for exceptions/errorsNew2017-09-06

History

#1 Updated by John Abbott over 8 years ago

  • Priority changed from Normal to High

Tracking down the problem in LinearSimplify (see issue #490) was impeded by the vagueness of the error message Bad Argument.

Increased priority to high.

How exactly are the supplementary details to be specified? Here is an example how it might look:

if (...) CoCoA_ERROR(ERR::BadArg+"1st arg must be prime", "SomeFunc");
if (...) CoCoA_ERROR(ERR::BadArg("1st arg must be prime"), "SomeFunc");

We must decide syntax and semantics (and implementation details). JAA finds the syntax ERR::blah("details") easy to read. The semantics should just be that the supplementary details are appended to the what string (at least, that is how it should appear to a user of a CoCoA::ErrorInfo object). The implementation could maintain a single "what" string, or perhaps a primary "what" string and a supplementary one -- at first sight, this latter seems more complicated without any obvious benefit, but I'd like to think about it more before discarding the idea.

#2 Updated by Anna Maria Bigatti about 8 years ago

  • Target version changed from CoCoALib-0.99540 Feb 2016 to CoCoALib-0.99560

#3 Updated by Anna Maria Bigatti about 8 years ago

  • Target version changed from CoCoALib-0.99560 to CoCoALib-0.99550 spring 2017

#4 Updated by John Abbott almost 8 years ago

  • Target version changed from CoCoALib-0.99550 spring 2017 to CoCoALib-0.99560

#5 Updated by Anna Maria Bigatti about 7 years ago

  • Status changed from New to In Progress

I'm getting quite annoyed with getting The arg(s) given are unsuitable in CoCoA-5: looks like being back at the CoCoA-4 unhelpful error messages!

While waiting to redesign error handling/classification/inheritance, we'd better create more error messages (maybe using some useful prefix like BADARG_, to facilitate the future translation to inheritance).

#6 Updated by John Abbott about 7 years ago

  • Priority changed from High to Urgent
  • % Done changed from 0 to 10

I agree that BadArg is unhelpful. It would be nice to settle this matter, and it would be nice to find some guidelines on how to design error hierarchies... Something to do over the easter weekend?
Priority increased.

I wonder if it could be helpful to have BadArg1 and BadArg2, so that there is some indication of which arg is causing the trouble? I can see that this might also be misleading in some cases.

Perhaps we should collect a few examples where the current behaviour is definitely unsatisfactory...

#7 Updated by Anna Maria Bigatti about 7 years ago

John Abbott wrote:

I agree that BadArg is unhelpful. It would be nice to settle this matter, and it would be nice to find some guidelines on how to design error hierarchies... Something to do over the easter weekend?
Priority increased.

I don't think we can fix this before next (imminent) release.

I wonder if it could be helpful to have BadArg1 and BadArg2, so that there is some indication of which arg is causing the trouble? I can see that this might also be misleading in some cases.

dangerous: some function may be called cascading from CoCoA-5 (see also just below)

One thing we should probably change is that CoCoA-5 should print more than just the main error message. Example:

 
      if (N <= 0) CoCoA_ERROR(ERR::BadArg, "LucasTest(N):  N must be positive");

This is a misuse of the second argument which (by current design) should only be the name of the function (as a workaround of not being able to extract it automatically).

So, either we decide that the second argument has a different use (==> passed to CoCoA-5), of the information "N must be positive" should be part of the first argument.

Maybe the function name (i.e. second argument) should indeed be passed to CoCoA-5 toghether with the error message (i.e. first argument), whereas the other details (file name, line number)

#8 Updated by Anna Maria Bigatti about 7 years ago

On the line of what I said earlier, I implemented in Interpreter.C the function MESSAGE(err) to be called instead of message(err).
It just prints message + context. Have a try and see how it looks (cvs-ed).

May be improved, and is not THE solution to this issue, but it is a quick solution to the problem of unhelpful error messages in CoCoA-5.

#9 Updated by John Abbott about 7 years ago

I agree that resolving this issue will take more time than we can invest in the next release.

I think it would be helpful to collect some examples where the current error response is distinctly unhelpful.

#10 Updated by Anna Maria Bigatti about 7 years ago

#11 Updated by Anna Maria Bigatti about 7 years ago

  • Related to Design #427: Error names and error messages (current design) added

#12 Updated by Anna Maria Bigatti about 7 years ago

There are some notes about "classes of errors" in the CoCoALib documentation for error, section "=== new improved list of errors ==="
(see also issue #92 for parallel discussion)

#13 Updated by Anna Maria Bigatti about 7 years ago

  • Related to Feature #1045: Error message from cocoalib to cocoa-5 added

#14 Updated by John Abbott over 6 years ago

  • Target version changed from CoCoALib-0.99560 to CoCoALib-0.99600

#15 Updated by John Abbott almost 6 years ago

  • Target version changed from CoCoALib-0.99600 to CoCoALib-0.99650 November 2019

#16 Updated by John Abbott about 5 years ago

  • Target version changed from CoCoALib-0.99650 November 2019 to CoCoALib-0.99700

It would be nice to have a quiet moment to get this matter properly sorted out.

We really should try to deal with it soon! Something to discuss next time Anna and I meet (where and when?)

#17 Updated by John Abbott over 4 years ago

  • Target version changed from CoCoALib-0.99700 to CoCoALib-0.99800

#18 Updated by John Abbott over 3 years ago

  • Target version changed from CoCoALib-0.99800 to CoCoALib-0.99850

I am postponing even though this is urgent. I need a quiet period to be able to think about the problem, and to find a good solution.
Next likely chance for a quiet period might be in Feb/March 2021 (depending on how much chaos Brexit triggers).

#19 Updated by Anna Maria Bigatti over 2 years ago

  • Related to Bug #1622: BuiltinOneLiners -- less precise location in error messages added

#20 Updated by John Abbott over 2 years ago

Anna suggests that the error message should also indicate which args (via their indices, starting from 0 or 1?)
For instance in FloatApprox the err mesg should be something like arg 2, relative error must be between 0 and 1

I suppose "2nd arg" is probably clearer than "arg 2"...?

#21 Updated by Anna Maria Bigatti over 2 years ago

We agreed that the string for the name of the function should contain just the name of the function, and its arguments.
So we could have

  if (N <= 0) CoCoA_ERROR(ERR::MustBePositive, "N", "LucasTest(N)");

#22 Updated by Anna Maria Bigatti over 2 years ago

for example, this would be nice

/**/  EulerTotient(-100);
--> ERROR: arg N must be strictly positive
--> [CoCoALib] EulerTotient(N)
--> /**/  EulerTotient(-100);
-->       ^^^^^^^^^^^^^^^^^^

#23 Updated by John Abbott about 1 year ago

  • Target version changed from CoCoALib-0.99850 to CoCoALib-0.99880

#24 Updated by John Abbott about 1 month ago

  • Related to Bug #1089: invalid pointer in "free" added

#25 Updated by John Abbott about 1 month ago

  • Related to deleted (Bug #1089: invalid pointer in "free")

#26 Updated by John Abbott about 1 month ago

  • Related to Design #1098: Ctors for exceptions/errors added

#27 Updated by John Abbott about 1 month ago

Let's finish this for version 1.0

Also available in: Atom PDF