Leonardus
Loading...
Searching...
No Matches
Macros | Enumerations | Functions
error.h File Reference

Error handling. More...

#include <string>
#include <cstdint>
#include <source_location>
+ Include dependency graph for error.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ERRPRAEFIX   "leo"
 Praefix for error messages of second pass.
 

Enumerations

enum  OpError : std::uint8_t {
  _invalid , success , invalidexit , rangecheck ,
  stackunderflow , typecheck , unmatchedmark , dictstackunderflow ,
  undefinedresult , undefined , invalidfileaccess , undefinedfilename ,
  ioerror
}
 Operator error code enum. More...
 
enum  InError : std::uint8_t { cmdline , parsererror , semantics , internal }
 Interpreter error code enum. More...
 

Functions

void opErrExit (OpError p_err, const std::string &p_details="", const std::source_location p_location=std::source_location::current())
 Write operator error message to interpreter out file and exit( EC_OPERATOR ).
 
void inErrExit (InError p_err, const std::string &p_details="", const std::source_location p_location=std::source_location::current())
 Write interpreter error message to interpreter out file and exit( EC_INTERPRETER / EC_CMDLINE ).
 
void panicExit (const char *p_msg1, const char *p_msg2=nullptr)
 Panic exit( EC_PANIC ).
 

Detailed Description

Error handling.

Enumeration Type Documentation

◆ InError

enum InError : std::uint8_t

Interpreter error code enum.

Enumerator
cmdline 

command line usage error

parsererror 

explicit or implicit error from pass 1

semantics 

infinite nesting of arrays; infinite loop loading values from dictionary;

internal 

float formating; context not initialized; counter less than zero; non dictionary object on dictionary stack

◆ OpError

enum OpError : std::uint8_t

Operator error code enum.

Enumerator
_invalid 

Represents: initialized but never changed.

success 

No operator error.

invalidexit 

operator error invalidexit

rangecheck 

operator error rangecheck

stackunderflow 

operator error stackunderflow

typecheck 

operator error typecheck

unmatchedmark 

operator error unmatchedmark

dictstackunderflow 

operator error dictstackunderflow

undefinedresult 

operator error undefinedresult

undefined 

operator error undefined

invalidfileaccess 

operator error invalidfileaccess

undefinedfilename 

operator error undefinedfilename

ioerror 

operator error ioerror

Function Documentation

◆ inErrExit()

void inErrExit ( InError  p_err,
const std::string &  p_details = "",
const std::source_location  p_location = std::source_location::current() 
)

Write interpreter error message to interpreter out file and exit( EC_INTERPRETER / EC_CMDLINE ).

Parameters
[in]p_errInterpreter error code.
[in]p_detailsDetails to add in message output.
[in]p_locationA paramter to hold std::source_location::current(). Never set explicitly.

◆ opErrExit()

void opErrExit ( OpError  p_err,
const std::string &  p_details = "",
const std::source_location  p_location = std::source_location::current() 
)

Write operator error message to interpreter out file and exit( EC_OPERATOR ).

Parameters
[in]p_errOperator error code.
[in]p_detailsDetails to add in message output.
[in]p_locationA paramter to hold std::source_location::current(). Never set explicitly.

◆ panicExit()

void panicExit ( const char *  p_msg1,
const char *  p_msg2 = nullptr 
)

Panic exit( EC_PANIC ).

Parameters
[in]p_msg1First message.
[in]p_msg2Second message. Defaults to nullptr.