1

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?

1 Answer 1

1

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.

6
  • Thanks for the answer, but somehow I have the feeling that this is sort of a workaround, or is it not?
    – JohnDoDo
    Apr 26, 2012 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, 2012 at 13:09
  • And that's the only way? You can't add fault handlers to a state machine workflow?
    – JohnDoDo
    Apr 26, 2012 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, 2012 at 14:35
  • Sorry.. each event driven activity has "view fault handlers" option, not a state.
    – Alexander
    Apr 26, 2012 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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