MCPcopy Create free account
hub / github.com/GenericMappingTools/gmt / gmtlib_report_error

Function gmtlib_report_error

src/gmt_api.c:8203–8225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8201/*! ===> Error message reporting */
8202
8203int gmtlib_report_error (void *V_API, int error) {
8204 /* Write error message to log or stderr, then return error code back.
8205 * All functions can call this, even if API has not been initialized. */
8206 FILE *fp = NULL;
8207 bool report;
8208 char message[GMT_LEN256];
8209 struct GMTAPI_CTRL *API = gmtapi_get_api_ptr (V_API);
8210
8211 report = (API) ? API->error != API->last_error : true;
8212 if (report && error != GMT_NOERROR) { /* Report error */
8213 if (!API || !API->GMT || (fp = API->GMT->session.std[GMT_ERR]) == NULL) fp = stderr;
8214 if (API && API->session_tag) {
8215 snprintf (message, GMT_LEN256, "[Session %s (%d)]: Error returned from GMT API: %s (%d)\n",
8216 API->session_tag, API->session_ID, gmt_api_error_string[error], error);
8217 GMT_Message (API, GMT_TIME_NONE, message);
8218 if (API->log_level) fflush (fp); /* Flush the latest message to file in case of crash */
8219 }
8220 else
8221 fprintf (fp, "Error returned from GMT API: %s (%d)\n", gmt_api_error_string[error], error);
8222 }
8223 if (API) API->last_error = API->error, API->error = error; /* Update API error value if API exists */
8224 return (error);
8225}
8226
8227/*! . */
8228int gmtlib_validate_id (struct GMTAPI_CTRL *API, int family, int object_ID, int direction, int module_input) {

Callers 15

gmtapi_next_io_sourceFunction · 0.85
gmtapi_export_paletteFunction · 0.85
gmtapi_export_postscriptFunction · 0.85
gmtapi_destroy_data_ptrFunction · 0.85
gmtapi_export_datasetFunction · 0.85
gmtlib_ind2rgbFunction · 0.85
gmtapi_export_imageFunction · 0.85
gmtapi_export_gridFunction · 0.85
gmtapi_export_cubeFunction · 0.85
gmtapi_export_matrixFunction · 0.85
gmtapi_export_vectorFunction · 0.85
gmtapi_export_dataFunction · 0.85

Calls 2

gmtapi_get_api_ptrFunction · 0.85
GMT_MessageFunction · 0.85

Tested by

no test coverage detected