• Register

Error Handling

Description

Bloomingdales' API - is "adapter" of Bloomingdales.com to remote clients. So there is we can distinguish 6 stages of using Bloomingdales' API and so 6 places of errors:

  • client can not establish connection to Bloomingdales' API
  • Bloomingdales' API can not adapt request to Bloomingdales.com
  • Bloomingdales' API can not establish connection to Bloomingdales.com
  • Bloomingdales' API can not adapt Bloomingdales.com response to client
  • Bloomingdales.com reply error response to Bloomingdales' API
  • Bloomingdales' API internal errors

First stage can not be processed by Bloomingdales' API so remains 5 types of errors returned from Bloomingdales' API. Error codes divided in 5 diapasones:

  • 100-199 Forward Compatibility Errors(1xx) - These errors are created as a result of a impossibility of translating client request to  Bloomingdales API request: can not map request, incorrect arguments, etc.
  • 200-299 Connection Errors(2xx) - These errors are created as a result of a connection failing to be established to a Bloomingdales.com server. They will contain a brief description of why a connection could not be established. This class of errors contains "full stack" connections errors: TCP connection, HTTP request/responce, Hessian RPC-call. Also this class of errors contains all stages of connection establishing, using, closing, timeouting, etc. 
  • 300-399 Backward Compatibility Errors(3xx) - Bloomingdales sent correct response(in business-logic sence) to Gateway but Gateway can't convert to correct JSON.
  •  400-499 Web Server Response Codes And Messages(4xx) - call to Bloomingdales returned correct erorr message so we translate (perhaps with some transformations).
  •  500-599. Internal Errors(5xx) - Some error during processing request or general error-state of gateway or low resources for processing - no threads in pools, low free memory, etc.

In every diapasone first error code(100, 200, 300, 400, 500) has "General" sence. So in test/development/production mode we can return only 5 not specialized codes.


back to top

Detailed description

1. Forward Compatibility Errors(1xx)

Bloomingdales' API error code HTTP status code Description
100 400 General Forward Compatibility Errors
101 404 There is no mapping for request at all.
102 404 There is no mapping for request temporary.
103 400 Incorrect argument types or combination. Can not form args for Hessian RPC-call.
104 404 Can form args but this method temporary closed for using (by admin for example).
105 400 Incorrect HTTP-headers (no heder at all or incorrect or dublicated etc)
106 400 Unknown client ID

back to top

2. Connection Errors(2xx)

This class of errors contains "full stack" connections errors: TCP connection, HTTP request/responce, Hessian RPC-call. Also this class of errors contains all stages of connection establishing, using, closing, timeouting, etc.

Bloomingdales' API error code HTTP status code Description
200 502 General connection error ("Connection error")
TCP:

201 504 Can not establish TCP connection ("Connection error")
202 504 Timeout establishing TCP connection ("Connection error")
203 502 IOException exception during using TCP connection ("Connection error")
204 504 Timeout reading data from TCP connection ("Timeout error")
HTTP:

220 502 Wrong HTTP response ("Connection error")
Hessian RPC:

240 500 Internal Hessian transport exception (like IOException) ("Connection error")
241 502 Hessian serialization exception (like ClassNotFoundException) ("Connection error")
242 400 Secure connection required

back to top

3. Backward Compatibility Errors(3xx)

Bloomingdales' API error code HTTP status code Description
300 500 General Backward Compatibility Error ("Cant form result")
301 500 Type mismatch ("Remote-local type mismatch")

back to top

4. Web Server Response Codes And Messages(4xx)

Bloomingdales' API error code HTTP status code Description
400 502 General Bloomingdales error ("Remote error").
401 502 Unknown Bloomingdales error ("Unknown remote error").
402 404 No data ("No data").
403 400 Upgrade required for client id.
404 403 Access denied for client id.
405 401 Authentication required.
406 500 Authentication failed.
407 400 Invalid data type.

back to top

5. Internal Errors(5xx)

Bloomingdales' API error code HTTP status code Description
500 500 General internal error ("Internal error").
501 500 Unknown exception ("Unknown internal error").
502 503 Server too busy ("Server too busy").
503 503 Server temporary unavailable ("Server temporary unavailable").
504
Config file not found
505
Unable to read config file(Permission denied/Corrupt file)
506 504 Gateway Timeout

back to top

Sample Errored Request and Response

Sample Request 1

URL:

 http://api.macys.com/v1/catalog/reviews?productId=7758

HTTP Header:

x-Bloomingdales-webservice-client-id: 123456789 (The API key is wrong in this case.  It should be xmj9js4jkdpe1983fmwu98gh not 123456789.  You will also get this response if your keys are not activated. Please reach out to apisupport@Bloomingdales.com if you are having trouble getting your key approved)

Accept: application/json

 

Http Status: 403 Forbidden

Response:

<h1>Developer Inactive</h1>

 

Sample Request 2

URL:

 http://api.bloomingdales.com/v1/catalog/reviews?productId=7758 (The URL in this case is trying to hit a v1 service that does not exist.  It should be v3 not v1)

HTTP Header:

x-macys-webservice-client-id: xmj9js4jkdpe1983fmwu98gh

Accept: application/json

 

Http Status: 404 Not Found

Response:

{errorCode: 101
message: "There is no mapping for request"
-errorDetail: [1]
0: &nbsp;"<a href="http://services2.bloomingdales.com/resources/v1/catalog/reviews?productId=7758" 
_mce_href="http://services2.bloomingdales.com/resources/v1/catalog/reviews?productId=7758" 
title="Click to insert into URL field">http://services2.bloomingdales.com/resources/v1/catalog/reviews?productId=7758</a>"
success: false}

 

back to top

Docs Navigation