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