Actual source code: errstop.c
1: #include <petscsys.h>
2: #include "err.h"
4: /*@C
5: PetscMPIAbortErrorHandler - Calls `PETSCABORT()` and exits.
7: Not Collective, No Fortran Support
9: Input Parameters:
10: + comm - communicator over which error occurred
11: . line - the line number of the error (indicated by `__LINE__`)
12: . fun - the function name
13: . file - the file in which the error was detected (indicated by `__FILE__`)
14: . mess - an error text string, usually just printed to the screen
15: . n - the generic error number
16: . p - `PETSC_ERROR_INITIAL` if error just detected, otherwise `PETSC_ERROR_REPEAT`
17: - ctx - error handler context
19: Level: developer
21: Note:
22: Users do not directly call this routine
24: Use `PetscPushErrorHandler()` to set the desired error handler. The
25: currently available PETSc error handlers include `PetscTraceBackErrorHandler()`,
26: `PetscMPIAbortErrorHandler()`, `PetscAttachDebuggerErrorHandler()`, and `PetscAbortErrorHandler()`.
28: .seealso: `PetscError()`, `PetscPushErrorHandler()`, `PetscPopErrorHandler()`, `PetscAttachDebuggerErrorHandler()`,
29: `PetscAbortErrorHandler()`, `PetscTraceBackErrorHandler()`, `PetscEmacsClientErrorHandler()`, `PetscReturnErrorHandler()`
30: @*/
31: PetscErrorCode PetscMPIAbortErrorHandler(MPI_Comm comm, int line, const char *fun, const char *file, PetscErrorCode n, PetscErrorType p, const char *mess, void *ctx)
32: {
33: PetscFunctionBegin;
34: if (!mess) mess = " ";
36: if (n == PETSC_ERR_MEM || n == PETSC_ERR_MEM_LEAK) (void)PetscErrorMemoryMessage(n);
37: else if (n == PETSC_ERR_SUP) {
38: (void)(*PetscErrorPrintf)("%s() at %s:%d\n", fun, file, line);
39: (void)(*PetscErrorPrintf)("No support for this operation for this object type!\n");
40: (void)(*PetscErrorPrintf)("%s\n", mess);
41: } else if (n == PETSC_ERR_SIG) (void)(*PetscErrorPrintf)("%s() at %s:%d %s\n", fun, file, line, mess);
42: else (void)(*PetscErrorPrintf)("%s() at %s:%d\n %s\n", fun, file, line, mess);
44: PETSCABORT(PETSC_COMM_WORLD, n);
45: PetscFunctionReturn(PETSC_SUCCESS);
46: }