Refactored API error objects