petsc-3.7.1 2016-05-15
Report Typos and Errors

# PetscError

Routine that is called when an error has been detected, usually called through the macro SETERRQ(PETSC_COMM_SELF,).

### Synopsis

    #include "petscsys.h"
    PetscErrorCode  PetscError(MPI_Comm comm,int line,const char *func,const char *file,PetscErrorCode n,PetscErrorType p,const char *mess,...)

Not Collective Many br

### Input Parameters

| comm | - communicator over which error occurred. ALL ranks of this communicator MUST call this routine Many br
| line | - the line number of the error (indicated by __LINE__) Many br
| func | - the function where the error occured (indicated by __FUNCT__) Many br
| file | - the file in which the error was detected (indicated by __FILE__) Many br
| mess | - an error text string, usually just printed to the screen Many br
| n | - the generic error number Many br
| p | - PETSC_ERROR_INITIAL indicates the error was initially detected, PETSC_ERROR_REPEAT indicates this is a traceback from a previously detected error Many br
| mess | - formatted message string - aka printf Many br

Many br

### Notes

Most users need not directly use this routine and the error handlers, but Many brcan instead use the simplified interface SETERRQ, which has the calling Many brsequence Many br

        SETERRQ(comm,n,mess)

Experienced users can set the error handler with PetscPushErrorHandler(). Many br

Developer Note: Since this is called after an error condition it should not be calling any error handlers (currently it ignores any error codes) Many brBUT this routine does call regular PETSc functions that may call error handlers, this is problematic and could be fixed by never calling other PETSc routines Many brbut this annoying. Many br

### See Also

PetscTraceBackErrorHandler(), PetscPushErrorHandler(), SETERRQ(), CHKERRQ(), CHKMEMQ, SETERRQ1(), SETERRQ2()

Level:intermediate
Location:src/sys/error/err.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/vec/vec/examples/tutorials/ex21.c.html