Invalid Argument errors provide per field details. (#110)
* Invalid Argument errors now return a per field error message. * Creating an API error struct. * SDK uses field error details proto. * Adding tests specifically for handler helper error messages resulting in expected API output. * Inlining the error checks into the table driven tests. Use protocmp for assertions to make printing out diffs easier to parse. * Aggregate the invalid argument fields detected to be wrong. * Make the returned order of fields deterministic in the error details.. * Fixing formatting issue in errors_test.go. * Test to confirm unimplemented results in a 405 and not 404.
This commit is contained in:
1 parent
5333482ff8
commit
2c3fbe3024
10 files changed
+317
-186
No files matched your search
@@ -7,7 +7,13 @@ option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api
|
||||
message ErrorDetails {
|
||||
string TraceId = 1 [json_name="TraceId"];
|
||||
string request_id = 2 [json_name="request_id"];
|
||||
repeated string request_fields = 3 [json_name="request_fields"];
|
||||
repeated FieldError request_fields = 3 [json_name="request_fields"];
|
||||
}
|
||||
|
||||
// FieldErrors contains error information on a per field basis.
|
||||
message FieldError {
|
||||
string name = 1;
|
||||
string description= 2;
|
||||
}
|
||||
|
||||
// Error is returned by the JSON API when an error occurs.
|
||||
|
||||
Reference in new issue
Block a user