update to cocoa style error handling