We shall improve the error response at once, currently, there are several problems:
name is type of error which is confusing.
code is just HTTP status code, which doesn't have to be in JSON response.
info doesn't have standardized fields or documentation.
So instead of:
"error": {
"name": "Invalid",
"reason": "InvariantViolated",
"message": "identity already exists",
"code": 400,
"info": {
"cause": {
"kind": "DuplicatedIdentity"
}
}
}
We shall change to:
"error": {
"type": "TypeOfError"
"code": "Short String for the Error"
"message": "Human readable message"
"info": { }
}
The main changes from the current design are:
- Use
type instead of name for the category of error. Using name as type is very confusing. We also should have a list of type possible values.
- HTTP status code should go back to HTTP response header
code and message are the actual error
- We shall study the APIs used this error scheme, and try to come up with a standardized object for
info, otherwise it is not usable at all (or else we need to write a spec to indicate what error will have which info, but it is not as good as a standardized object.
Original rename suggested by Louis
- DuplicatedIdentity becomes its own error
- IdentityModifyDisabled becomes its own error
- NoAuthenticator becomes its own error
- MismatchedUser becomes its own error
- Keep ErrClaimNotVerifiable unchanged.
We shall improve the error response at once, currently, there are several problems:
nameis type of error which is confusing.codeis just HTTP status code, which doesn't have to be in JSON response.infodoesn't have standardized fields or documentation.So instead of:
We shall change to:
The main changes from the current design are:
typeinstead ofnamefor the category of error. Usingnameastypeis very confusing. We also should have a list oftypepossible values.codeandmessageare the actual errorinfo, otherwise it is not usable at all (or else we need to write a spec to indicate what error will have whichinfo, but it is not as good as a standardized object.Original rename suggested by Louis