Home > Article > Backend Development > Question: Looking for return code specification design specifications?
It is best to follow a set of return status code rules in a system, or even a team or a company, and plan in advance, such as:
0001 ~ 1999, 2000 ~ 2999, 4000 ~ 4999
These code segments can be planned in advance according to: business type, function type, and architecture level. For example, x~y is the network segment, which segment is used for error codes, and which segment is used for success codes. It feels like this from the architectural level The points are relatively clear, and you can immediately tell whether it is a success or a failure, and then you can also identify the characteristics of the business layer based on the numbers in other bits. I feel that the combination of these types of plans has the best effect, and I give the code segment. In this way, the overall planning can be unified.
ABCD four digits
A:?
B:?
C:?
D:?
Relatively mature systems, such as WeChat, some software, and websites will have a return status code in various situations or when various errors occur. I know that this status code exists in every business. There are so many businesses in a system, so there must be one. A good return code design is standardized.
I would like to ask how you generally design this kind of specification, what standards do you follow, and where can I find reference materials?
(I remember seeing the interface return code design standards of Meituan Waimai somewhere before, but now I forgot and can’t find it)
It is best to follow a set of return status code rules in a system, or even a team or a company, and plan in advance, such as:
0001 ~ 1999, 2000 ~ 2999, 4000 ~ 4999
These code segments can be planned in advance according to: business type, function type, and architecture level. For example, x~y is the network segment, which segment is used for error codes, and which segment is used for success codes. It feels like this from the architectural level The points are relatively clear, and you can immediately tell whether it is a success or a failure, and then you can also identify the characteristics of the business layer based on the numbers in other bits. I feel that the combination of these types of plans has the best effect, and I give the code segment. In this way, the overall planning can be unified.
ABCD four digits
A:?
B:?
C:?
D:?
Relatively mature systems, such as WeChat, some software, and websites will have a return status code in various situations or when various errors occur. I know that every business has this status code. With so many businesses in a system, there must be one. A good return code design is standardized.
I would like to ask how you generally design this kind of specification, what standards do you follow, and where can I find reference materials?
(I remember seeing the interface return code design standards of Meituan Waimai somewhere before, but now I forgot and can’t find it)