Use exceptions instead of error codes