Change Format of API Error (#784)
This is a wire breaking change for json errors since we have removed and renamed a few fields, and changed part of the structure of the returned json error. * Remove redundant fields in Status, details.error_id, details.TraceId and details.request_id from API errors. * Added wrapped errors and "ops" field to indicate the internal operation of the errors returned by the API. * Added error cli error reporting of Op and wrapped errors.
This commit is contained in:
1 parent
18ea39b237
commit
aa4157639c
48 files changed
+742
-728
No files matched your search
@@ -4,15 +4,20 @@ package controller.api.v1;
|
||||
|
||||
option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api;api";
|
||||
|
||||
// Error information relevant to an error that was wrapped by the backend.
|
||||
message WrappedError {
|
||||
// An string indicating what operation was being run when the wrapped error was created.
|
||||
string op = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
// Additional details regarding a specific error.
|
||||
message ErrorDetails {
|
||||
// The TraceId that can be used for OpenTelemetry.
|
||||
string TraceId = 1 [json_name="TraceId"];
|
||||
// A request ID.
|
||||
string request_id = 2 [json_name="request_id"];
|
||||
// An Error ID.
|
||||
string error_id = 3 [json_name="error_id"];
|
||||
// Request-field-specific error details.
|
||||
repeated FieldError request_fields = 4 [json_name="request_fields"];
|
||||
repeated FieldError request_fields = 1 [json_name="request_fields"];
|
||||
|
||||
// The errors that were wrapped in the backend for this returned error.
|
||||
repeated WrappedError wrapped_errors = 2 [json_name="wrapped_errors"];
|
||||
}
|
||||
|
||||
// FieldErrors contains error information on a per field basis.
|
||||
@@ -26,10 +31,10 @@ message FieldError {
|
||||
|
||||
// Error is returned by the JSON API when an error occurs.
|
||||
message Error {
|
||||
// The HTTP Status code applicable to this error.
|
||||
int32 status = 1;
|
||||
// An application-specific error string.
|
||||
string code = 2;
|
||||
// The kind of error this is.
|
||||
string kind = 1;
|
||||
// An string indicating what operation was being run when the error was returned.
|
||||
string op = 2;
|
||||
// A human-readable explanation specific to this occurrence of the error.
|
||||
string message = 3;
|
||||
// Additional metadata regarding the error. Depending on the error, different fields will be populated.
|
||||
|
||||
Reference in new issue
Block a user