Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add reason field to Details in GoogleJsonErrorObject (#1831)
Fixes b/191502543 google-api-java-client id parsing error objects without `reason` field in `details`. The actual error message: ``` { "error": { "code": 400, "message": "The subscription is in a state that is not valid for the requested operation", "status": "FAILED_PRECONDITION", "details": [ { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "ERROR_CODE_SUBSCRIPTION_BAD_STATE" } ] } } ``` But when it get parsed through java api-client, it becomes: ``` { "code" : 400, "details" : [ { "@type" : "type.googleapis.com/google.rpc.ErrorInfo" } ], "message" : "The subscription is in a state that is not valid for the requested operation", "status" : "FAILED_PRECONDITION" } ```
- Loading branch information
Showing
4 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...nt/src/test/resources/com/google/api/client/googleapis/json/errorWithReasonInDetails.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"error": { | ||
"code": 400, | ||
"message": "The template parameters are invalid.", | ||
"status": "INVALID_ARGUMENT", | ||
"details": [ | ||
{ | ||
"@type": "type.googleapis.com/google.dataflow.v1beta3.InvalidTemplateParameters", | ||
"reason": "TEST REASON 1", | ||
"parameterViolations": [ | ||
{ | ||
"parameter": "safeBrowsingApiKey", | ||
"description": "Parameter didn't match regex '^[0-9a-zA-Z_]+$'" | ||
} | ||
] | ||
}, | ||
{ | ||
"@type": "type.googleapis.com/google.rpc.DebugInfo", | ||
"detail": "test detail" | ||
}, | ||
{ | ||
"@type": "type.googleapis.com/google.rpc.DebugInfo", | ||
"reason": "test reason 2" | ||
}, | ||
{ | ||
"@type": "type.googleapis.com/google.rpc.DebugInfo" | ||
} | ||
] | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters