Bookmarks

Throw an exception or return an error value

2010/06/09 | Comment?

You have created a nice, well written function, but you realize you forgot something: The failure case.
What should a function do when it fails? There are two schools for this – the “throw an exception” school and the “return an error value” school.
But which of these is the correct approach?

Via Codeutopia

Share and Enjoy:
  • Tumblr
  • Twitter
  • FriendFeed
  • Digg
  • StumbleUpon
  • del.icio.us
  • Technorati
  • Sphinn
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • RSS
Tags: , , ,

have your say

:

:


«
»