Error handling

The evaluation errors are as follows:

  • Missing value: This error occurs when the cell referred in a formula does not hold a value
  • Reference out of range: This error occurs when a reference is outside the scope of the spreadsheet
  • Circular reference: This error occurs when a cell is referring to itself, directly or indirectly
  • Division by zero: This error occurs when the denominator in a division expression is zero

There is also the syntax error that occurs when the user inputs a syntactically incorrect formula.

Error.h

enum ErrorId {SyntaxError, CircularReference, ReferenceOutOfRange, 
              DivisionByZero, MissingValue}; 
 
class Error : public exception { 
  public: 
    Error(ErrorId errorId); 
    String ErrorText() const; 
 
  private: 
    ErrorId errorId; 
}; 

Get C++ Windows Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.