# PetscError

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

### Synopsis

    #include "petsc.h"
    PetscErrorCode PETSC_DLLEXPORT PetscError(int line,const char *func,const char* file,const char *dir,PetscErrorCode n,int p,const char *mess,...)

Not Collective

### Input Parameters

| line | - the line number of the error (indicated by __LINE__)
| func | - the function where the error occured (indicated by __FUNCT__)
| dir | - the directory of file (indicated by __SDIR__)
| file | - the file in which the error was detected (indicated by __FILE__)
| mess | - an error text string, usually just printed to the screen
| n | - the generic error number
| p | - 1 indicates the error was initially detected, 0 indicates this is a traceback from a previously detected error
| mess | - formatted message string - aka printf

### Notes

Most users need not directly use this routine and the error handlers, but can instead use the simplified interface SETERRQ, which has the calling sequence

        SETERRQ(n,mess)

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

### See Also

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

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