Error information: error_info XML Data

When the API detects an error with an API call, the EWA will return non-200 status code in response, e.g., 500(Internal Error), or 400(Bad Request), and others. 

Details of the error are defined in an XML data package, error_info which will return to client application. The error_info is described below.

API error condition at Web API Level



<error_info
errorcode = “111” 					// API error code
message = “Exception occurs when logging in 3scale.”	// short error message
> 				
  <details>
      CS_threescale.ApiException: application_not_found : application with id="46329c141" was not found
      at CS_threescale.Api.aux_authorize(Int32 key_type, String id, String key)
      at Wilcom.EWA.ThreeScale.Login(String appId, String appKey, String[] metricNames)
      at Wilcom.EWA.Controllers.BaseController.Authenticate3Scale(String appId, String appKey, AuthorizeResponse&amp; threeScaleReponse)
  </details>
</error_info>

Usage:

The error_info xml string is used in:

  • All methods.

Remarks:

The error_info will be returned if something wrong when processing request. The response’s status code is not ok (200).

errorcode is an integer. Each code represents a kind of errors. Here is the list:

  • 100: internal Error, Unknown exception occurs in API. The details element will carry more information. Http status code is InternalServerError(500).
  • 101: Input Error, one or some post parameters are missing or wrong. message describes the reason. Http status code is BadRequest(400).
  • 102: Recipe Error, exception occurs when serializing or deserializing XML data packages.  The details element will carry more information. Http status code is InternalServerError(500).
  • 103: Design Format Error, the input or output design file format is not supported by API. message describes the reason. Http status code is BadRequest(400).
  • 110: Authentication Fail, fail to authenticate App Id and App Key. The details element will carry more information. Http status code is Unauthorized (401).
  • 111: Authentication Error, exception occurs when authenticating App Id and App Key. The details element will carry more information. Http status code is Unauthorized (401).
  • 120: CAD Server Error, exception occurs inside CAD Server. cadcode has error code returned by CAD Server. The details element will carry more information. Http status code is InternalServerError(500).
  • 121: CAD Interoperation Error, exception occurs when calling CAD Server. The details element will carry more information. Http status code is InternalServerError(500).

message is a short message to describe the error.

details are detailed error information. It will help programmer to develop client side or API developer to analysis the error.

API error condition related to the underlying CAD Server

Cad server has its own error code to represent different errors. A dedicated attribute cadcode is for it. For example:

<error_info
errorcode = “120” 					// API error code
message = “Exception occurs inside CAD Server.”		// short error message
cadcode=”0x1E”					// cad error code
> 				
  <details>						// detailed error information
       	Wilcom.Servers.CADEmbServer.CADException: Call to EmbServer_GetDesignInfo failed.
Return code: ERROR_READ_FAULT
   at Wilcom.Servers.CADEmbServer.CADEmbServer.CallCadServerAPI(String methodName, Object[] methodParams)
   at Wilcom.Servers.CADEmbServer.CADEmbServer.GetDesignInfo(String designFilename)
   ……					
  </details>
</error_info>

Usage:

The error_info xml string is used in:

  • All methods.

Remarks:

cadcode is only available when errorcode is 120. It is hex string returned from CAD Server. The known cad codes are:

0x22100011: ERROR_INCORRECT_XML_DATA_STRUCTURE, the xml structure is incorrect.

0x20000100: ERROR_INVALID_VERSION, the design_version specified in recipe is invalid.

0x20000104: ERROR_FILEVERSION_TO_GREAT, a design file specified in recipe could not be opened because it was created with newer version of software.

0x20000106: ERROR_FILE_VERSION_OBSOLETE, a design file specified in recipe could not be opened because it was created with old version of software which isn’t supported anymore.

0x22100010: ERROR_NOT_A_SINGLE_LETTERING_DESIGN: the recipe does not contain a single Lettering decoration specification or a single Team Name Lettering with a single name decoration specification.

0x54F:  ERROR_INTERNAL_ERROR, an internal error has occurred.

0x22100001: ERROR_BAD_PTR, an internal error has occurred.

0x1E: ERROR_READ_FAULT, this file’s format does not match the expected format for this extension.  For stitch design files, the source software may be creating non-standard formats.  Check with the source of the file.

0x21000014: ERROR_INVALID_DESIGN_EXTENTS_STITCH, the design cannot be output because part of the design lies outside the stitching area.

0x21000018: ERROR_INVALID_HOOP_FOR_MACHINE_MODEL, the opened design contains a Hoop which is not supported on the target machine.

0x21000032: ERROR_COLOR_SECTION_TOO_BIG, the design cannot be split as it contains a color part (layer) for which the stitch count exceeds the limit. 0x21000033: ERROR_DESIGN_EXCEEDS_MACHINE_STITCH_AREA, the design cannot be output because part of the design lies outside the maximum stitching area of the target machine.