petsc-3.13.6 2020-09-29
Report Typos and Errors

PetscPushErrorHandler

Sets a routine to be called on detection of errors.

Synopsis

#include "petscsys.h" 
PetscErrorCode  PetscPushErrorHandler(PetscErrorCode (*handler)(MPI_Comm comm,int,const char*,const char*,PetscErrorCode,PetscErrorType,const char*,void*),void *ctx)
Not Collective

Input Parameters

handler - error handler routine
ctx - optional handler context that contains information needed by the handler (for example file pointers for error messages etc.)

Calling sequence of handler

   int handler(MPI_Comm comm,int line,char *func,char *file,PetscErrorCode n,int p,char *mess,void *ctx);

comm - communicator over which error occured
line - the line number of the error (indicated by __LINE__)
file - the file in which the error was detected (indicated by __FILE__)
n - the generic error number (see list defined in include/petscerror.h)
p - PETSC_ERROR_INITIAL if error just detected, otherwise PETSC_ERROR_REPEAT
mess - an error text string, usually just printed to the screen
ctx - the error handler context

Options Database Keys

Notes

The currently available PETSc error handlers include PetscTraceBackErrorHandler(), PetscAttachDebuggerErrorHandler(), PetscAbortErrorHandler(), and PetscMPIAbortErrorHandler(), PetscReturnErrorHandler().

Fortran Notes

You can only push one error handler from Fortran before poping it.

See Also

PetscPopErrorHandler(), PetscAttachDebuggerErrorHandler(), PetscAbortErrorHandler(), PetscTraceBackErrorHandler(), PetscPushSignalHandler()

Level

intermediate

Location

src/sys/error/err.c

Examples

src/ksp/ksp/tutorials/ex27.c.html

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages
-on_error_attach_debugger <noxterm,gdb or dbx>- - -on_error_abort