Announcement Announcement Module
Collapse
No announcement yet.
Catching "Unable to load a flow definition: no flow id was provided..." exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Catching "Unable to load a flow definition: no flow id was provided..." exception

    Hello,

    I have one question: why is "Unable to load a flow definition: no flow id was provided" exception defined as java.lang.IllegalArgumentException?

    I would like to catch exactly this exception and display my index page (with menus that start flows), but I don't see how this could be done (except for checking 'message' property of exception, but this is something I'd rather not do)
    Any ideas?


    Thanks,
    Igor.

  • #2
    <error-page>
    tag in web.xml would do it.

    Comment


    • #3
      Problem is not catching an exception - I already have SpringMVC configured to do so. But I don't want to catch all IllegalArgumentException, but just the one that webflow threw when no flow id was provided.

      My original question was more rethorical, why is there no specific exception like:
      org.springframework.webflow.NoFlowIdProvidedExcept ion
      but instead we have general
      java.lang.IllegalArgumentException?

      The guys from my testing department seems to like making bookmarks in the middle of the flow, and then calling them later - which results in calling flow controller without flow id. I don't want to punish them with some ugly error page, but rather redirect them application's main page.

      Comment


      • #4
        How about a try catch block where the exception is thrown
        and throw new exception


        where
        class NoFlowIdException extends Exception {

        }

        have web.xml catch NoFlowIdException

        Comment


        • #5
          I'm not sure I'm following you...

          That exception is thrown internally by webflow - not from my classes. I don't know exactly what class within webflow infrastructure threw exception, and even if I do, what then - subclass it and override its methods? This is not something I would like to do. AND, even if I do that, the mehod that is throwing no-flow-id-IllegalArgumentException may also be throwing other IllegalArgumentExceptions, so how do I know which is which?

          Comment


          • #6
            In web.xml you can either define error pages for http error codes or for exception types:

            Code:
            <error-page>
                <exception-type>org.....NoSuchFlowExecutionException</exception-type>
                 <location>invalid-flow.jsp</location>
            </error-page>

            Comment


            • #7
              Ask Keith about the new exception hierarchy

              Hi Guys,

              I think you've all missed Igor's point. He is not asking about how to handle exceptions in general. Rather, he is inquiring about a possibly flawed use of an IllegalArgumentException where an application specific Exception would make more sense.

              Originally posted by imilina
              I have one question: why is "Unable to load a flow definition: no flow id was provided" exception defined as java.lang.IllegalArgumentException?
              If this is truly the case, I would recommend that you determine exactly which class is throwing this exception by analyzing the stack trace. Then supply that along with the release version of SWF you're using to Keith for review.

              Originally posted by imilina
              I would like to catch exactly this exception and display my index page (with menus that start flows), but I don't see how this could be done (except for checking 'message' property of exception, but this is something I'd rather not do)
              Any ideas?
              Keith and Erwin have been working on a new, more comprehensive exception hierarchy for SWF. Thus, your issue might have already been solved.

              @Keith: have you looked into Igor's issue as well?

              Regards,

              Sam

              Comment


              • #8
                Thank you Sam, it is nice to see that somebody finally understand what I'm talking about, I was beginning to think that I'm talking swahili here - never thought my english is that bad...

                Anyway, just a few days ago I switched from ea to rc3, and noticed that not supplying "_flowId" when calling flow results in specific exception:
                org.springframework.webflow.executor.support.FlowE xecutorArgumentExtractionException,
                which is exactly what I had in mind.

                SWF team, keep up the good work

                Regards,
                Igor.

                Comment

                Working...
                X