Project

General

Profile

Bug #287

--fullCoCoALibError prints too much (Try/UponError)

Added by Anna Maria Bigatti over 11 years ago. Updated over 7 years ago.

Status:
New
Priority:
Normal
Category:
Parser/Interpreter
Target version:
Start date:
12 Dec 2012
Due date:
% Done:

10%

Estimated time:
35.00 h
Spent time:

Description

When using the flag --fullCoCoALibError CoCoA-5 prints the full CoCoALib error message.

It does so even inside the Try command.

It is not very important because such flag should be used only by CoCoALib developers (or only by me??), but it would be nice to disable that printing.


Related issues

Related to CoCoA-5 - Feature #101: rethrow in Try .. UponError .. EndTryNew2012-03-08

History

#1 Updated by Anna Maria Bigatti over 11 years ago

It seems difficult to do because the error is actually dealt with by a proper C++ try, whereas printing (the error message) is just a function call.
The functions doing the work are in Interpreter.C:
  • void TryStatement::implExecute(RuntimeEnvironment * runtimeEnv)
  • void RuntimeEnvironment::announceCLE(const ErrorInfo& err)

#2 Updated by John Abbott over 11 years ago

Here is a simplistic solution: print all the "stack backtrace" information to a string. If the error is caught somewhere, discard the string. If the error propagates all the way to top level, print the string.

This simplistic solution does not work properly if an error is caught but then rethrown -- unfortunately the CoCoA-5 language does not let the programmer //rethrow// an error.

Perhaps the backtrace string should be emptied only if the UponError block is exited cleanly (//i.e.// not via another throw)?

In fact, the backtrace may be recorded in a structure other than a string. Anyway, the basic idea is to record it somewhere and then print it out if the exception reaches top-level.

#3 Updated by Anna Maria Bigatti over 10 years ago

  • Target version changed from CoCoA-5.0.9 to CoCoA-5.1.0 Easter14

#4 Updated by John Abbott about 10 years ago

  • Target version changed from CoCoA-5.1.0 Easter14 to CoCoA-5.1.1 Seoul14

#5 Updated by Anna Maria Bigatti almost 10 years ago

  • Subject changed from --fullCoCoALibError prints too much to --fullCoCoALibError prints too much (Try/UponError)
  • Target version changed from CoCoA-5.1.1 Seoul14 to CoCoA-5.?.?

#6 Updated by Anna Maria Bigatti about 8 years ago

  • Assignee set to Anna Maria Bigatti
  • Target version changed from CoCoA-5.?.? to CoCoA-5.2.0 spring 2017
  • % Done changed from 0 to 10

Ooops, apparently I released the Mac version of cocoa-5.1.4 with the flag activated.
This means that users computing "gin" will probably get the (innocuous but intrusive) error

***************************************************************************
****CoCoA ERROR****  ErrCode: CoCoA::ERR::InsuffPrec
****CoCoA ERROR****  Message: RingTwinFloat: insufficient precision (e.g. error growth impedes further computation)
****CoCoA ERROR****  Context: RingTwinFloat arithmetic
***************************************************************************

#7 Updated by John Abbott about 8 years ago

  • Estimated time set to 35.00 h

I still like my proposal in comment 2. How easy it will be to implement is not clear to me.

Anyway the implementation does not need to be especially efficient.

I like the idea of storing the backtrace in a structure somewhere, and then printing only when necessary.

I'm not really sure, but reckon this could take a whole week to sort out: about half time to read and understand the existing interpreter code, and the other half to make the necessary changes.

#8 Updated by John Abbott over 7 years ago

  • Target version changed from CoCoA-5.2.0 spring 2017 to CoCoA-5.?.?

Also available in: Atom PDF