| 1134 | */ |
| 1135 | |
| 1136 | void 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 | |
| 1159 | void (*global_inputErrorHandler)(const char*, const char*) = default_inputErrorHandler; |
| 1160 |
nothing calls this directly
no test coverage detected