MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / default_inputErrorHandler

Function default_inputErrorHandler

quest/src/core/validation.cpp:1136–1157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1134 */
1135
1136void default_inputErrorHandler(const char* func, const char* msg) {
1137
1138 // safe to call even before MPI has been setup, and ignores user-set trailing newlines.
1139 // It begins with \n to interrupt half-printed lines (when trailing newlines are set to
1140 // 0 via setNumReportedNewlines(0)), for visual clarity. Note that user's overriding
1141 // functions might not think to print an initial newline but oh well!
1142 print(string("\n")
1143 + "QuEST encountered a validation error during function "
1144 + "'" + func + "':\n" + msg + "\n"
1145 + "Exiting...\n");
1146
1147 // force a synch because otherwise non-main nodes may exit before print, and MPI
1148 // will then attempt to instantly abort all nodes, losing the error message.
1149 comm_sync();
1150
1151 // finalise MPI before error-exit to avoid scaring user with giant MPI error message
1152 if (comm_isInit())
1153 comm_end();
1154
1155 // simply exit, interrupting any other process (potentially leaking)
1156 exit(EXIT_FAILURE);
1157}
1158
1159void (*global_inputErrorHandler)(const char*, const char*) = default_inputErrorHandler;
1160

Callers

nothing calls this directly

Calls 4

printFunction · 0.85
comm_syncFunction · 0.85
comm_isInitFunction · 0.85
comm_endFunction · 0.85

Tested by

no test coverage detected