Tuesday, October 7, 2008

Whether to Make Exceptions unchecked

Typically we throw all these BlaUnknown exceptions when creating things.

Like when creating a Device, you need a DeviceType to exist. So the createDevice() method throws a DeviceTypeUnknown exception.

These make method calls very clunky because you have to catch all of these exceptions.

I thought of making them unchecked because you expect these things to exist when you are creating a device, and if they don't, its an internal runtime error.

Shafiek pointed out two reasons against this:
if it does happen, it's could be the result of another user deleting something - in which case this should be conveyed to the current user.

WebServices Need to know what exceptions will be thrwon.