:orphan:
# PetscCallBack
Calls a user provided PETSc callback function and then checks the resulting error code, if it is non-zero it calls the error handler and returns from the current function with the error code. 
## Synopsis
```
#include <petscerror.h>
void PetscCallBack(const char *functionname,PetscFunction(args))
```
Not Collective; No Fortran Support


## Input Parameters

- ***functionname -*** the name of the function being called, this can be a string with spaces that describes the meaning of the callback
- ***PetscFunction -*** user provided callback function that returns an error code



## Example Usage
```none
  PetscCallBack("XXX callback to do something",a->callback(...));
```





## Notes
Once the error handler is called the calling function is then returned from with the given
error code. Experienced users can set the error handler with `PetscPushErrorHandler()`.

`PetscCallBack()` should only be called in PETSc when a call is being made to a user provided call-back routine.


## See Also
 `SETERRQ()`, `PetscCheck()`, `PetscCall()`, `PetscAssert()`, `PetscTraceBackErrorHandler()`, `PetscCallMPI()`
`PetscPushErrorHandler()`, `PetscError()`, `CHKMEMQ`, `CHKERRA()`, `CHKERRMPI()`, `PetscCall()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petscerror.h.html#PetscCallBack">include/petscerror.h</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petscerror.h)


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