A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Exception-Handling Cycle - Why Bother?

  1. #1
    dmacker = new Person()
    Join Date
    Jan 2005
    Location
    Woburn, MA
    Posts
    143

    Unhappy Exception-Handling Cycle - Why Bother?

    I've got a basic understanding of how the try/catch/finally block works, but I can't seem to figure out why I should bother using it.

    If I know an error is occurring or about to occur, why build a try/catch/finally architecture to 'gracefully' handle the error when I could write code to prevent the error from occurring in the first place?

    Thanks in advance for any enlightenment on this subject.
    I am an instance of the Person class.

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    99% of your code should be proofed by you at code-time. That said, there are times when you can't guarantee what code will come into your swf - especially if you're using the javascript interface, or allowing user-input, or trying to or run complex applications dynamically.

  3. #3
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Or loading a resource from a server.

  4. #4
    dmacker = new Person()
    Join Date
    Jan 2005
    Location
    Woburn, MA
    Posts
    143

    Question exception-handling application

    Is it fair to say that exception-handling is used for projects that need to manipulate dynamic external data and not really useful for more encapsulated-type projects?
    I am an instance of the Person class.

  5. #5
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I'd say that's a decent characterization. But once the project gets relatively complex, the odds are that you will end up dealing with external data, even if it's just user input.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center