MoorDyn
Modules | Macros | Typedefs
Errors reported by MoorDyn
Collaboration diagram for Errors reported by MoorDyn:

Modules

 The list of error codes returned by the C API
 

Macros

#define MAKE_EXCEPTION(name)
 Simple macro to define custom exceptions. More...
 
#define MOORDYN_THROW(err, msg)
 Exception thrown for invalid input files. More...
 
#define MOORDYN_CATCHER(err, msg)
 

Typedefs

typedef int moordyn::error_id
 Error identifier.
 

Detailed Description

Macro Definition Documentation

◆ MAKE_EXCEPTION

#define MAKE_EXCEPTION (   name)
Value:
class name : public std::runtime_error \
{ \
public: \
name(const char* msg) \
: std::runtime_error(msg) \
{ \
} \
};

Simple macro to define custom exceptions.

◆ MOORDYN_CATCHER

#define MOORDYN_CATCHER (   err,
  msg 
)

Catch thrown exceptions and convert them in an error_id. It also gives the message on the Exception. This macro will only handle known exceptions, i.e. the ones declared in moordyn_errors. You can add more catch() instances afterwards

◆ MOORDYN_THROW

#define MOORDYN_THROW (   err,
  msg 
)
Value:
switch (err) { \
break; \
throw moordyn::input_file_error(msg); \
break; \
throw moordyn::output_file_error(msg); \
break; \
throw moordyn::input_error(msg); \
break; \
throw moordyn::nan_error(msg); \
break; \
throw moordyn::mem_error(msg); \
break; \
throw moordyn::invalid_value_error(msg); \
break; \
throw moordyn::non_implemented_error(msg); \
break; \
default: \
throw moordyn::unhandled_error(msg); \
break; \
}
#define MOORDYN_INVALID_INPUT_FILE
Invalid input file path.
Definition: MoorDynAPI.h:145
#define MOORDYN_MEM_ERROR
Memory errors, like filures allocating memory.
Definition: MoorDynAPI.h:153
#define MOORDYN_INVALID_OUTPUT_FILE
Invalid output file path.
Definition: MoorDynAPI.h:147
#define MOORDYN_INVALID_VALUE
Invalid values.
Definition: MoorDynAPI.h:155
#define MOORDYN_NON_IMPLEMENTED
Invalid values.
Definition: MoorDynAPI.h:157
#define MOORDYN_INVALID_INPUT
Invalid input in the input file.
Definition: MoorDynAPI.h:149
#define MOORDYN_NAN_ERROR
NaN detected.
Definition: MoorDynAPI.h:151
#define MOORDYN_SUCCESS
Successfully dispatched task.
Definition: MoorDynAPI.h:143

Exception thrown for invalid input files.

Exception thrown for invalid output files Exception thrown for invalid input values Exception thrown when NaN values are encountered Exception thrown when memory errors are triggered Exception thrown when invalid values are found Exception thrown when something is not implemented yet Exception thrown when an invalid type is asked Exception thrown for other uhandled errors Throw the exception associated with the provided error. Do nothing if MOORDYN_SUCCESS is passed