Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a running Site workflow. If the workflow fails for whatever reason, I want to log it in a special way so that I don't have to struggle with the ULS log to figure out what went wrong.

How can I add a general (catch all) fault handler to a Site state machine workflow (all examples I find are for sequential workflows)?

Is it even possible?

share|improve this question
add comment

1 Answer

Try to use SPWorkflowEventReceiver. If I'm not wrong the WorkflowPostponed is invoked when the exception is thrown. In this method you have access to the SPWorkflowEventProperties. There are ErrorException and ErrorMessage properties that can be used by you.

share|improve this answer
    
Thanks for the answer, but somehow I have the feeling that this is sort of a workaround, or is it not? –  JohnDoDo Apr 26 '12 at 12:25
    
It is not a workaround. There is a question about this in the Microsoft SharePoint 2010 Application Development exam. –  Alexander Apr 26 '12 at 13:09
    
And that's the only way? You can't add fault handlers to a state machine workflow? –  JohnDoDo Apr 26 '12 at 14:17
    
As I know each state of the workflow has own fault handler. You can try to create activity that is handle the exception and add it to this fault handler. To see it you can click Fault Handler context menu item. –  Alexander Apr 26 '12 at 14:35
    
Sorry.. each event driven activity has "view fault handlers" option, not a state. –  Alexander Apr 26 '12 at 14:42
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.