Skip to end of banner
Go to start of banner

Error Handling in APIs

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Error Codes and response thrown by Increff System

In case of a 400 or 500 in the Assure system , the below JSON body will be thrown.

Note: In case of status code 500, have a retry mechanism in place.

{
    "code": "BAD_DATA",
    "message": "Input validation failed",
    "description": "[channelSkuCode: may not be null]"
}

Error Codes and response thrown by client system 

Http Status Code 200  

Case 1 : This HttpStatus code means the request call to the client system is successful. So we expect no payload as of now.

Case 2 : There are some systems which are unable to send 4xx and 5xx in case of any error happening in their systems. They can only send 200 HttpStatusCode with a payload. In these cases , they can send the following payload along with HttpStatus Code 200.

{
    "hasError": true,
    "errorMessage": "Something"
}

Note : This is not a general case. We don’t recommend going for Case 2. It should only be used in case the client system is not able to throw 4xx and 5xx in error scenarios.

Also , this payload is only necessary in case the system has some error.In case the request is successful , the system can choose to send the same payload as "hasError":false.

By default we will assume that there is no error in the client system if there is no payload from the client system with HttpStatusCode 200 and we will mark it as a successful request in Assure.

Http Status Code 4xx

The client system should throw an error with HttpStatusCode of series 4xx. In these cases the payload remains the same as before i.e.

Assure Magic will try to deserialize the 4xx series into the following payload .If it’s able to deserialize into the following payload then it will be converted to a proper string which will be visible to any warehouse user.

{
    "hasError": true,
    "errorMessage": "Something"
}

The message which gets printed on the Increff screen.

"Error from channel : Something"

In case , Assure magic is not able to deserialize into a given payload. 

Then only the following message will be displayed in the Increff screens.

"Error from channel : Unreadable message from channel with HttpCode : 4xx"

Http Status Code 5xx

In case there is an error thrown with 5xx HttpStatusCode. The process remains the same as the 4xx case. We would expect the following payload with 5xx HttpStatusCode.

{
    "hasError": true,
    "errorMessage": "Something"
}

The message which gets printed on the Assure WMS screen.

"Error from channel : Something more"

In case , Assure magic is not able to deserialize into a given payload. Then only the following message will be displayed in the Assure WMS screen.

"Error from channel : Unreadable message from channel with HttpCode : 5xx"

Note : There can be scenarios where the client system is down or there is an unhandled error. Then also the same error message will be displayed on the Assure WMS screen.

  • No labels