1 Reply Latest reply on Apr 23, 2009 4:15 PM by run,ryan!

    What is Considered Best Practice for Error Handling in Components?

    Miggl Level 1

      What would be the best approach to handling errors in custom (possibly composite) components?


      I see three different possibilities:

      1. Having the error handling funciton within the component. The problem is that this is not adaptable to the consumers error handling setup (i.e. logging to database, redirecting to a pretty error screen, etc.).
      2. Passing in an error function as a parameter. The problem here is how to have the externally defined error function interact with external elements that are not defined within the component, i.e. passing the error or fault object to a logging class, or something similar, of which the component knows nothing about.
      3. Referencing the external error handling methods directly from within the component. (Of course that's shabby programming, just listing as a technical option.)


      How do you solve this?

      My goal is to have a versatile custom component that can utilize any given consumer's error handler.