Callback to handle workflow exception

Is it possible to handle workflow failure after all retries? I have 3 retries for activities in workflow and 3 retries for whole workflow, i want to save failed status after all 3*3 retries failled.