handle non-json error responses better