Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

CHAPTER 7: Best Practices & Community > Put Thought Into Your Error Handling

Put Thought Into Your Error Handling

Managing errors for plug-ins can be a tricky thing. The biggest question is, do you raise a hard error (i.e., completely stop everything) or do you raise a soft error and allow the user to continue using the application?

The answer is... “It depends.” To help determine how to handle each type of error you expect to encounter, you need to put yourself in the user's shoes. Ask yourself this: “Can the user properly continue if this error occurs?”

For a simple example, think about an item plug-in. If you encounter an error in the render function (i.e., the function that displays the item), what should you do? At a high level you have two options: raise an application error, making the page unusable by the user, or try to soften the blow and display a generic Unhandled error occurred. Please contact your system administrator. error message. In this case, it would make sense to raise an application error; the user couldn't, and probably shouldn't, continue with the application, since it's missing some data that it expects the user to see and modify.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint