WIP: API error handling framework and error codes.