Error codes

As per the Apigee doc the default error code format is

{"code":" {ErrorCode} ","message":" {Error message} ","contexts":[]}

But when i execute my proxy with error ,The format is :

{
  "ErrorCode": "{ErrorCode}",
  "Error": "{Error message}"
}

and sometimes

{
  "fault": {
    "faultstring": "",
    "detail": {
      "errorcode": "xxx"} }}

would like to know when these error formats will occur and also when the default format will get executed?

Note : I dint add any FaultRules.

Correct me if i am wrong .Thanks!

0 7 1,003
7 REPLIES 7

Good catch & great points @maivizhi ,

I think it's a doc issue, As far as i know the common error format is ,

{  
   "fault":{  
      "faultstring":"Execution of JavaScript-1 failed with error: Javascript runtime error: \"ReferenceError: \"dfsd\" is not defined. (JavaScript-1.js:1)\"",
      "detail":{  
         "errorcode":"steps.javascript.ScriptExecutionFailed"
      }
   }
}

When / where do you see below error format ? OnPrem / Cloud ? Which version ?

{
  "ErrorCode": "{ErrorCode}",
  "Error": "{Error message}"
}

Thanks @Anil Sagar

I am getting

{"ErrorCode":"{ErrorCode}","Error":"{Error message}"}

in Cloud version(when i try to get accesstoken without user credentials)

@Anil Sagar, I just opened a doc issue to review how error codes are documented. Thanks.

Thank you @wwitman

Thanks, @wwitman. I also updated the error format/example in http://docs.apigee.com/api-services/content/fault-handling to match the current invalid API key error.

Thanks @wwitman and @Floyd Jones for updating the doc.

Between i am getting

{
  "ErrorCode": "invalid_client",
  "Error": "Client identifier is required"
}

when i try to generate accesstoken (for any granttype) without user credential(Client_id and Secret). In this case what will be my fault.name ?

@maivizhi Please see this doc that describes the error responses for OAuthV2 policy operations: http://docs.apigee.com/api-services/reference/oauth-http-status-code-reference. The error format you get is expected for the OAuthV2 GenerateAccessToken operation. We're working on updating the docs with correct error response formats. We're sorry for your confusion. Apparently the docs state incorrect error codes in some cases. Thank you for pointing out these inconsistencies!