MR WHY

I am
Wang Hongyang

Wechat Official Account
Find fun things here!

Error Code Table for Error Handling

Hubert Wang
2016-09-28
Recent Update:
2016-10-02
All error handling functions have been rewritten and all of them are now in the scripts/errorHandling.js file.
Previous works:
1. RESTful Web Services Design of Uber
2. Uber REST - Car, Driver, Passenger Entity

Codes and Script Folder

  • Code on Github
  • Note that: Error Handling code (scripts/errorHandling.js) is in Script folder, and all the error handling function are in this folder.

Error Code Table (New, all codes are based on this table)

Error Code Error Message Relevant Resources Parameters
1001 attribute required All Resources None
1002 attribute value's length is less than minlength All Resources None
1003 attribute value's length is longer than maxlength All Resources None
1004 invalid attribute {0} format All Resources {0} = email, phone
1005 invalid attribute value type All Resources None
1006 identifier not matching any resource instance All Resources None
1007 identifier should not provided when patching All Resources None

Error Code Table (Previous Edition, not used anymore)

Error Code Error Message Relevant Resources Parameters
1001 request body is empty All Resources None
1002 id should not be provided All Resources None
1003 Identifier not matching any resource instance All Resources None
1004 Invalid resource name {0} given All Resources 0 - Resource Name
2001 car attributes {0} in request body is incomplete cars 0 - Attribute Name
2002 car attributes {0} type invalid cars 0 - Attribute Name
2003 car attribute value is invalid cars None
2004 car attribute value not unique cars None
2005 car attribute key is invalid cars None
3001 driver attributes in request body is incomplete drivers None
3002 driver attributes {0} type invalid drivers 0 - Attribute Name
3003 driver attribute value is invalid drivers None
3004 driver attribute value not unique drivers None
3005 driver attribute key is invalid drivers None
4001 passenger attributes in request body is incomplete passengers None
4002 passenger attributes {0} type invalid passengers 0 - Attribute Name
4003 passenger attribute value is invalid passengers None
4004 passenger attribute value not unique passengers None
4005 passenger attribute key is invalid passengers None
5001 ride attributes in request body is incomplete rides None
5002 ride attributes {0} type invalid rides 0 - Attribute Name
5003 ride attribute value is invalid rides None
5004 ride attribute value not unique rides None
5005 ride attribute key is invalid rides None

Results

1001 - request body is empty

1002 - id should not be provided

1003 - Identifier not matching any resource instance

1004 - Invalid resource name {0} given

2001 - car attributes {0} in request body is incomplete

2002 - car attributes {0} type invalid

2003 - car attribute value is invalid

2004 - car attribute value not unique

2005 - car attribute key is invalid

toc

9

分享本文:

TOC