PETSc version 3.16.5
Fix/Edit manual page

# SETERRQ

Macro to be called when an error has been detected,

### Synopsis

    #include <petscsys.h>
    PetscErrorCode SETERRQ(MPI_Comm comm,PetscErrorCode ierr,char *message)

Collective

### Input Parameters

| comm | - A communicator, use PETSC_COMM_SELF unless you know all ranks of another communicator will detect the error
| ierr | - nonzero error code, see the list of standard error codes in include/petscerror.h
| message | - error message

### Notes

Once the error handler is called the calling function is then returned from with the given error code.

See SETERRQ1(), SETERRQ2(), SETERRQ3() for versions that take arguments

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

### Fortran Notes

SETERRQ() may be called from Fortran subroutines but SETERRA() must be called from the Fortran main program.

### See Also

PetscTraceBackErrorHandler(), PetscPushErrorHandler(), PetscError(), CHKERRQ(), CHKMEMQ, SETERRA(), SETERRQ1(), SETERRQ2(), SETERRQ3(), CHKERRMPI()

### Level

beginner

### Location

src/sys/error/../../../include/petscerror.h

### Examples

src/sys/classes/random/tutorials/ex1.c.html
src/sys/classes/random/tutorials/ex2.c.html
src/sys/tutorials/ex3.c.html
src/vec/vec/tutorials/ex6.c.html
src/vec/vec/tutorials/ex9.c.html
src/vec/vec/tutorials/ex10.c.html
src/vec/vec/tutorials/ex19.c.html
src/vec/is/is/tutorials/ex2.c.html
src/vec/is/is/tutorials/ex3.c.html
src/vec/is/sf/tutorials/ex2.c.html
src/mat/tutorials/ex1.c.html
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages