Actual source code: errstop.c
1: #include <petscsys.h>
2: #include "err.h"
4: /*@C
5: PetscMPIAbortErrorHandler - Calls PETSCABORT and exits.
7: Not Collective
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: PetscErrorCode ierr;
35: PetscFunctionBegin;
36: if (!mess) mess = " ";
38: if (n == PETSC_ERR_MEM || n == PETSC_ERR_MEM_LEAK) ierr = PetscErrorMemoryMessage(n);
39: else if (n == PETSC_ERR_SUP) {
40: ierr = (*PetscErrorPrintf)("%s() at %s:%d\n", fun, file, line);
41: ierr = (*PetscErrorPrintf)("No support for this operation for this object type!\n");
42: ierr = (*PetscErrorPrintf)("%s\n", mess);
43: } else if (n == PETSC_ERR_SIG) ierr = (*PetscErrorPrintf)("%s() at %s:%d %s\n", fun, file, line, mess);
44: else ierr = (*PetscErrorPrintf)("%s() at %s:%d\n %s\n", fun, file, line, mess);
46: (void)ierr;
47: PETSCABORT(PETSC_COMM_WORLD, n);
48: PetscFunctionReturn(PETSC_SUCCESS);
49: }