# PCSetErrorIfFailure
Causes `PC` to generate an error if a FPE, for example a zero pivot, is detected. 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode PCSetErrorIfFailure(PC pc, PetscBool flg)
```
Logically Collective


## Input Parameters

- ***pc -*** iterative context obtained from PCCreate()
- ***flg -*** `PETSC_TRUE` indicates you want the error generated





## Notes
Normally PETSc continues if a linear solver fails due to a failed setup of a preconditioner, you can call `KSPGetConvergedReason()` after a `KSPSolve()`
to determine if it has converged or failed. Or use -ksp_error_if_not_converged to cause the program to terminate as soon as lack of convergence is
detected.

This is propagated into KSPs used by this PC, which then propagate it into PCs used by those KSPs


## See Also
 `PC`, `KSPSetErrorIfNotConverged()`, `PCGetInitialGuessNonzero()`, `PCSetInitialGuessKnoll()`, `PCGetInitialGuessKnoll()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/interface/precon.c.html#PCSetErrorIfFailure">src/ksp/pc/interface/precon.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/pc/interface/precon.c)


[Index of all PC routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
