Add support for error handling

When an error occurs, "lastError" will be set to an appropriate
NSError instance. The method "clearLastError" can be called to set this
to nil.

The "setter" methods now return BOOLs. They will return YES if
successful, or NO if there's an error. If the "getter" methods return
nil/0/NO, "lastError" will have to be checked to see if an error
occurred, or if there was simply no value.