Updated error handling for errors that do not have codes

Not all errors return err_code in the response, resulting in a KeyError exception. This change fixes that and offers the error details as attributes on the APIError class.