OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
ErrorCodes.hpp
Go to the documentation of this file.
1
24#ifndef OPENSWMM_ENGINE_ERROR_CODES_HPP
25#define OPENSWMM_ENGINE_ERROR_CODES_HPP
26
27#include <string>
28#include <string_view>
29
30namespace openswmm {
31
32// ============================================================================
33// Error codes — matching legacy error.h / error.txt numeric values
34// ============================================================================
35
36enum ErrorCode : int {
38
39 // --- System errors (100s) ---
40 ERR_MEMORY = 101,
44
45 // --- Object validation errors (108–145) ---
49 ERR_LENGTH = 111,
53 ERR_SLOPE = 115,
55 ERR_XSECT = 119,
58 ERR_LOOP = 131,
70
71 // --- Hydrology errors (151–159) ---
79
80 // --- Treatment ---
82
83 // --- Curves / timeseries (171–173) ---
86
87 // --- Snow / LID (181–188) ---
95
96 // --- Date / reporting (191–195) ---
100
101 // --- Input parsing (200–235) ---
102 ERR_INPUT = 200,
104 ERR_ITEMS = 203,
107 ERR_NAME = 209,
120
121 // --- File I/O (301–363) ---
156
157 // --- System / API errors (500–509) — legacy API error keys ---
168
169 // --- New 6.0 errors (600+) ---
174};
175
176// ============================================================================
177// CFFI error codes — categorical codes from the C API
178// ============================================================================
179// These map to the SWMM_ErrorCode enum in openswmm_engine.h and provide
180// broad categories. Use error_get_cffi_template() to get descriptions.
181
200
201// ============================================================================
202// CFFI warning codes
203// ============================================================================
204
215
216// ============================================================================
217// Warning codes — matching legacy text.h WARN01–WARN12
218// ============================================================================
219
239
240// ============================================================================
241// Lookup and formatting
242// ============================================================================
243
255std::string_view error_get_template(int code) noexcept;
256
262std::string_view warning_get_template(int code) noexcept;
263
274std::string format_error(int code, std::string_view name = "");
275
287std::string format_error(int code, std::string_view name, std::string_view detail);
288
296std::string format_warning(int code, std::string_view name = "");
297
301std::string format_warning(int code, std::string_view name, std::string_view detail);
302
303// ============================================================================
304// CFFI / C API code lookup
305// ============================================================================
306
312std::string_view cffi_error_get_template(int code) noexcept;
313
319std::string_view cffi_warning_get_template(int code) noexcept;
320
327std::string format_cffi_error(int code, std::string_view name = "");
328
335std::string format_cffi_warning(int code, std::string_view name = "");
336
337} /* namespace openswmm */
338
339#endif /* OPENSWMM_ENGINE_ERROR_CODES_HPP */
Definition NodeCoupling.cpp:15
CffiErrorCode
Definition ErrorCodes.hpp:182
@ CFFI_ERR_NUMERICAL
numerical solver error
Definition ErrorCodes.hpp:197
@ CFFI_ERR_HOTSTART
hot start file error
Definition ErrorCodes.hpp:195
@ CFFI_ERR_IO
file I/O error
Definition ErrorCodes.hpp:194
@ CFFI_ERR_RPTFILE
cannot open report file
Definition ErrorCodes.hpp:186
@ CFFI_ERR_LIFECYCLE
invalid engine lifecycle state transition
Definition ErrorCodes.hpp:189
@ CFFI_ERR_PLUGIN
plugin initialization or execution error
Definition ErrorCodes.hpp:193
@ CFFI_ERR_PARSE
input parsing error
Definition ErrorCodes.hpp:188
@ CFFI_OK
Definition ErrorCodes.hpp:183
@ CFFI_ERR_NOMEM
memory allocation error
Definition ErrorCodes.hpp:184
@ CFFI_ERR_BADINDEX
invalid object index
Definition ErrorCodes.hpp:191
@ CFFI_ERR_INTERNAL
internal engine error
Definition ErrorCodes.hpp:198
@ CFFI_ERR_BADHANDLE
invalid engine handle
Definition ErrorCodes.hpp:190
@ CFFI_ERR_CRS
coordinate reference system error
Definition ErrorCodes.hpp:196
@ CFFI_ERR_BADPARAM
invalid parameter value
Definition ErrorCodes.hpp:192
@ CFFI_ERR_INPFILE
cannot open input file
Definition ErrorCodes.hpp:185
@ CFFI_ERR_OUTFILE
cannot open output file
Definition ErrorCodes.hpp:187
std::string format_cffi_error(int code, std::string_view name)
Format a CFFI error message.
Definition ErrorCodes.cpp:342
std::string_view cffi_warning_get_template(int code) noexcept
Get the description for a CFFI warning code (SWMM_WarnCode).
Definition ErrorCodes.cpp:336
std::string_view warning_get_template(int code) noexcept
Get the description template for a warning code.
Definition ErrorCodes.cpp:206
std::string_view cffi_error_get_template(int code) noexcept
Get the description for a CFFI error code (SWMM_ErrorCode).
Definition ErrorCodes.cpp:330
WarnCode
Definition ErrorCodes.hpp:220
@ WARN_NEGATIVE_OFFSET
negative offset ignored for Link s
Definition ErrorCodes.hpp:224
@ WARN_DRY_STEP_INCREASED
dry weather time step increased to the wet weather time step
Definition ErrorCodes.hpp:227
@ WARN_INLET_REMOVED
inlet removed due to unsupported shape for Conduit s
Definition ErrorCodes.hpp:233
@ WARN_MIN_SLOPE
minimum slope used for Conduit s
Definition ErrorCodes.hpp:226
@ WARN_MIN_ELEV_DROP
minimum elevation drop used for Conduit s
Definition ErrorCodes.hpp:225
@ WARN_BOUNDARY_OVERLAP
boundary regions overlap for s
Definition ErrorCodes.hpp:237
@ WARN_MAX_DEPTH_INCREASED
maximum depth increased for Node s
Definition ErrorCodes.hpp:223
@ WARN_TIMESERIES_DUPLICATE_X
Time Series s has duplicate x values.
Definition ErrorCodes.hpp:236
@ WARN_ELEV_DROP_EXCEEDS
elevation drop exceeds length for Conduit s
Definition ErrorCodes.hpp:229
@ WARN_WET_STEP_REDUCED
wet weather time step reduced to recording interval for Rain Gage s
Definition ErrorCodes.hpp:222
@ WARN_REGULATOR_CREST_LOW
crest elevation is below downstream invert for regulator Link s
Definition ErrorCodes.hpp:231
@ WARN_ROUTING_STEP_REDUCED
routing time step reduced to the wet weather time step
Definition ErrorCodes.hpp:228
@ WARN_CONTROL_RULE_ATTR
non-matching attributes in Control Rule s
Definition ErrorCodes.hpp:232
@ WARN_GAGE_INTERVAL
time series interval greater than recording interval for Rain Gage s
Definition ErrorCodes.hpp:230
@ WARN_NONE
Definition ErrorCodes.hpp:221
std::string format_cffi_warning(int code, std::string_view name)
Format a CFFI warning message.
Definition ErrorCodes.cpp:354
ErrorCode
Definition ErrorCodes.hpp:36
@ ERR_FILE_NAME
files share same names
Definition ErrorCodes.hpp:122
@ ERR_RAIN_GAGE_TSERIES
time series for Rain Gage s is also used by another object
Definition ErrorCodes.hpp:77
@ ERR_LID_LAYER
missing layer for LID s
Definition ErrorCodes.hpp:91
@ ERR_RUNOFF_IFACE_READ
error in reading from runoff interface file
Definition ErrorCodes.hpp:139
@ ERR_RAIN_FILE_SEQUENCE
line is out of sequence in rainfall data file s
Definition ErrorCodes.hpp:132
@ ERR_RAIN_GAGE_FORMAT
inconsistent rainfall format for Rain Gage s
Definition ErrorCodes.hpp:76
@ ERR_TRANSECT_SEQUENCE
transect station out of sequence
Definition ErrorCodes.hpp:112
@ ERR_KEYWORD
invalid keyword s
Definition ErrorCodes.hpp:105
@ ERR_REPORT_DATE
report start date comes after ending date
Definition ErrorCodes.hpp:98
@ ERR_TABLE_FILE_OPEN
could not open external file used for Time Series s
Definition ErrorCodes.hpp:154
@ ERR_TIMESERIES_EMPTY
Time Series s has no data.
Definition ErrorCodes.hpp:170
@ ERR_API_PROPERTY_VALUE
invalid property value
Definition ErrorCodes.hpp:166
@ ERR_TRANSECT_TOO_MANY
Transect s has too many stations.
Definition ErrorCodes.hpp:114
@ ERR_API_NOT_ENDED
simulation not ended
Definition ErrorCodes.hpp:161
@ ERR_DATETIME
invalid date/time s
Definition ErrorCodes.hpp:109
@ ERR_RAIN_IFACE_SCRATCH
cannot open scratch rainfall interface file
Definition ErrorCodes.hpp:129
@ ERR_API_OBJECT_NAME
invalid object name
Definition ErrorCodes.hpp:164
@ ERR_MATH_EXPR
invalid math expression
Definition ErrorCodes.hpp:118
@ ERR_RAIN_FILE_CONFLICT
ambiguous station ID for Rain Gage s
Definition ErrorCodes.hpp:75
@ ERR_DIVIDER
Divider s does not have two outlet links.
Definition ErrorCodes.hpp:61
@ ERR_REGULATOR_SHAPE
Regulator s has invalid cross-section shape.
Definition ErrorCodes.hpp:68
@ ERR_CLIMATE_FILE_READ
error in reading from climate file s
Definition ErrorCodes.hpp:145
@ ERR_NONE
Definition ErrorCodes.hpp:37
@ ERR_TRANSECT_MANNING
Transect s has no Manning's N.
Definition ErrorCodes.hpp:115
@ ERR_RAIN_IFACE_FORMAT
invalid format for rainfall interface file
Definition ErrorCodes.hpp:134
@ ERR_SLOPE
adverse slope for Conduit s
Definition ErrorCodes.hpp:53
@ ERR_LENGTH
invalid length for Conduit s
Definition ErrorCodes.hpp:49
@ ERR_LID_TYPE
no type specified for LID s
Definition ErrorCodes.hpp:90
@ ERR_MULTI_OUTLET
Node s has more than one outlet link.
Definition ErrorCodes.hpp:59
@ ERR_RUNOFF_IFACE_COMPAT
incompatible data found in runoff interface file
Definition ErrorCodes.hpp:137
@ ERR_DUP_NAME
duplicate ID name s
Definition ErrorCodes.hpp:106
@ ERR_NODE_DEPTH
Node s has initial depth greater than maximum depth.
Definition ErrorCodes.hpp:64
@ ERR_TABLE_FILE_READ
invalid data in external file used for Time Series s
Definition ErrorCodes.hpp:155
@ ERR_MEMORY
memory allocation error
Definition ErrorCodes.hpp:40
@ ERR_ITEMS
too few items
Definition ErrorCodes.hpp:104
@ ERR_HOTSTART_COMPAT
incompatible data found in hot start interface file
Definition ErrorCodes.hpp:141
@ ERR_INFILTRATION
invalid infiltration parameters
Definition ErrorCodes.hpp:119
@ ERR_ROUTING_IFACE
cannot open routing interface file s
Definition ErrorCodes.hpp:150
@ ERR_INP_FILE
cannot open input file
Definition ErrorCodes.hpp:123
@ ERR_ROUTING_IFACE_NAMES
mis-matched names in routing interface file s
Definition ErrorCodes.hpp:152
@ ERR_AQUIFER_PARAMS
invalid parameter values for Aquifer s
Definition ErrorCodes.hpp:47
@ ERR_XSECT
invalid cross section for Link s
Definition ErrorCodes.hpp:55
@ ERR_TRANSECT_TOO_FEW
Transect s has too few stations.
Definition ErrorCodes.hpp:113
@ ERR_HOTSTART_READ
error in reading from hot start interface file
Definition ErrorCodes.hpp:142
@ ERR_ROUGHNESS
invalid roughness for Conduit s
Definition ErrorCodes.hpp:51
@ ERR_CONTROL_RULE
control rule clause invalid or out of sequence
Definition ErrorCodes.hpp:110
@ ERR_INPUT_LINE
too many characters in input line
Definition ErrorCodes.hpp:103
@ ERR_RDII_IFACE_SCRATCH
cannot open scratch RDII interface file
Definition ErrorCodes.hpp:147
@ ERR_OUTFALL
Outfall s has more than 1 inlet link or an outlet link.
Definition ErrorCodes.hpp:67
@ ERR_TIMESERIES_SEQUENCE
Time Series s has its data out of sequence.
Definition ErrorCodes.hpp:85
@ ERR_NUMBER
invalid number s
Definition ErrorCodes.hpp:108
@ ERR_REPORT_STEP
reporting time step or duration is less than routing time step
Definition ErrorCodes.hpp:99
@ ERR_LID_PARAMS
invalid parameter value for LID s
Definition ErrorCodes.hpp:92
@ ERR_BARRELS
invalid number of barrels for Conduit s
Definition ErrorCodes.hpp:52
@ ERR_TRANSECT_OVERBANK
Transect s has invalid overbank locations.
Definition ErrorCodes.hpp:116
@ ERR_SYSTEM
System exception thrown.
Definition ErrorCodes.hpp:158
@ ERR_CLIMATE_FILE_EOF
attempt to read beyond end of climate file s
Definition ErrorCodes.hpp:146
@ ERR_RPT_FILE
cannot open report file
Definition ErrorCodes.hpp:124
@ ERR_TIMESERIES_NAN
Time Series s contains NaN or Inf values.
Definition ErrorCodes.hpp:171
@ ERR_KINWAVE
cannot solve KW equations for Link s
Definition ErrorCodes.hpp:41
@ ERR_OUT_READ
error reading from binary results file
Definition ErrorCodes.hpp:128
@ ERR_NO_CLIMATE_FILE
no climate file specified for evaporation and/or wind speed
Definition ErrorCodes.hpp:143
@ ERR_NO_OUTLETS
Drainage system has no acceptable outlet nodes.
Definition ErrorCodes.hpp:69
@ ERR_RAIN_IFACE
cannot open rainfall interface file s
Definition ErrorCodes.hpp:130
@ ERR_LID_AREAS
LID area exceeds total area for Subcatchment s.
Definition ErrorCodes.hpp:93
@ ERR_TIMESTEP
cannot compute a valid time step
Definition ErrorCodes.hpp:43
@ ERR_TABLE_COL_MISMATCH
column count mismatch in data for s
Definition ErrorCodes.hpp:172
@ ERR_LID_CAPTURE_AREA
LID capture area exceeds total impervious area for Subcatchment s.
Definition ErrorCodes.hpp:94
@ ERR_STORAGE_VOLUME
Storage node s has negative volume at full depth.
Definition ErrorCodes.hpp:66
@ ERR_PUMP_LIMITS
startup depth not higher than shutoff depth for Pump s
Definition ErrorCodes.hpp:57
@ ERR_RUNOFF_IFACE_EOF
attempting to read beyond end of runoff interface file
Definition ErrorCodes.hpp:138
@ ERR_ELEV_DROP
elevation drop exceeds length for Conduit s
Definition ErrorCodes.hpp:50
@ ERR_API_OBJECT_TYPE
invalid object type
Definition ErrorCodes.hpp:162
@ ERR_ROUTING_IFACE_FORMAT
invalid format for routing interface file s
Definition ErrorCodes.hpp:151
@ ERR_START_DATE
simulation start date comes after ending date
Definition ErrorCodes.hpp:97
@ ERR_ODE_SOLVER
cannot open ODE solver
Definition ErrorCodes.hpp:42
@ ERR_RDII_IFACE
cannot open RDII interface file s
Definition ErrorCodes.hpp:148
@ ERR_INPUT
one or more errors in input file
Definition ErrorCodes.hpp:102
@ ERR_GAGE_TSERIES_NOTFOUND
Rain Gage s references unknown time series.
Definition ErrorCodes.hpp:173
@ ERR_RAIN_FILE_FORMAT
unknown format for rainfall data file s
Definition ErrorCodes.hpp:133
@ ERR_CLIMATE_FILE_OPEN
cannot open climate file s
Definition ErrorCodes.hpp:144
@ ERR_RDII_IFACE_FORMAT
invalid format for RDII interface file
Definition ErrorCodes.hpp:149
@ ERR_CYCLIC_TREATMENT
cyclic dependency in treatment functions at node s
Definition ErrorCodes.hpp:81
@ ERR_DIVIDER_LINK
Divider s has invalid diversion link.
Definition ErrorCodes.hpp:62
@ ERR_RUNOFF_IFACE
cannot open runoff interface file s
Definition ErrorCodes.hpp:136
@ ERR_API_PROPERTY_TYPE
invalid property type
Definition ErrorCodes.hpp:165
@ ERR_RAIN_GAGE_INTERVAL
recording interval greater than time series interval for Rain Gage s
Definition ErrorCodes.hpp:78
@ ERR_DUMMY_LINK
Node s has illegal DUMMY link connections.
Definition ErrorCodes.hpp:60
@ ERR_RAIN_IFACE_GAGE
no data in rainfall interface file for gage s
Definition ErrorCodes.hpp:135
@ ERR_UNITHYD_RATIOS
a Unit Hydrograph in set s has invalid response ratios
Definition ErrorCodes.hpp:73
@ ERR_SNOWPACK_PARAMS
invalid parameters for Snow Pack s
Definition ErrorCodes.hpp:89
@ ERR_RAIN_FILE_OPEN
cannot open rainfall data file s
Definition ErrorCodes.hpp:131
@ ERR_API_NOT_OPENED
project not opened
Definition ErrorCodes.hpp:159
@ ERR_SNOWMELT_PARAMS
invalid Snow Melt Climatology parameters
Definition ErrorCodes.hpp:88
@ ERR_RDII_AREA
invalid sewer area for RDII at node s
Definition ErrorCodes.hpp:74
@ ERR_OUT_SIZE
output will exceed maximum file size
Definition ErrorCodes.hpp:126
@ ERR_TRANSECT_NO_DEPTH
Transect s has no depth.
Definition ErrorCodes.hpp:117
@ ERR_SUBCATCH_OUTLET
ambiguous outlet ID name for Subcatchment s
Definition ErrorCodes.hpp:46
@ ERR_API_NOT_STARTED
simulation not started
Definition ErrorCodes.hpp:160
@ ERR_CURVE_SEQUENCE
Curve s has invalid or out of sequence data.
Definition ErrorCodes.hpp:84
@ ERR_API_OBJECT_INDEX
invalid object index
Definition ErrorCodes.hpp:163
@ ERR_HOTSTART_FILE
cannot open hot start interface file s
Definition ErrorCodes.hpp:140
@ ERR_NAME
undefined object s
Definition ErrorCodes.hpp:107
@ ERR_NO_CURVE
missing or invalid pump curve assigned to Pump s
Definition ErrorCodes.hpp:56
@ ERR_TRANSECT_UNKNOWN
data provided for unidentified transect
Definition ErrorCodes.hpp:111
@ ERR_WEIR_DIVIDER
Weir Divider s has invalid parameters.
Definition ErrorCodes.hpp:63
@ ERR_UNITHYD_TIMES
a Unit Hydrograph in set s has invalid time base
Definition ErrorCodes.hpp:72
@ ERR_ROUTING_IFACE_SAME
inflows and outflows interface files have same name
Definition ErrorCodes.hpp:153
@ ERR_NO_XSECT
no cross section defined for Link s
Definition ErrorCodes.hpp:54
@ ERR_OUT_FILE
cannot open binary results file
Definition ErrorCodes.hpp:125
@ ERR_REGULATOR
Regulator s is the outlet of a non-storage node.
Definition ErrorCodes.hpp:65
@ ERR_OUT_WRITE
error writing to binary results file
Definition ErrorCodes.hpp:127
@ ERR_API_TIME_PERIOD
invalid time period
Definition ErrorCodes.hpp:167
@ ERR_GROUND_ELEV
ground elevation is below water table for Subcatchment s
Definition ErrorCodes.hpp:48
@ ERR_LOOP
links form cyclic loops in the drainage system
Definition ErrorCodes.hpp:58
std::string_view error_get_template(int code) noexcept
Get the description template for an error code.
Definition ErrorCodes.cpp:200
CffiWarnCode
Definition ErrorCodes.hpp:205
@ CFFI_WARN_UNKNOWN_OPTION
unknown option in input file
Definition ErrorCodes.hpp:209
@ CFFI_WARN_HOTSTART_MISSING
hot start file not found, cold start used
Definition ErrorCodes.hpp:207
@ CFFI_WARN_NUMERICAL
numerical approximation used
Definition ErrorCodes.hpp:212
@ CFFI_WARN_STABILITY_LIMIT
time step reduced for stability
Definition ErrorCodes.hpp:213
@ CFFI_WARN_NONE
Definition ErrorCodes.hpp:206
@ CFFI_WARN_DEPRECATED_KW
deprecated keyword used
Definition ErrorCodes.hpp:210
@ CFFI_WARN_PLUGIN_INIT
plugin initialization warning
Definition ErrorCodes.hpp:211
@ CFFI_WARN_UNKNOWN_SECTION
unknown section in input file
Definition ErrorCodes.hpp:208