* Add error handler that converts from rpc.Status errors to Watchtower API errors. * Better testing for ErrorHandler. * Rename testcase and remove empty default switch case. * Change the error status back to int64. * Converting everything to int32s. jsonpb wraps int64s as a string which we dont like. We'll figure out how to use values larger than int64s when it comes up. * Remove special casing for TraceId which isn't needed anymore. * Removing wrappers from error details since we never need to know when they are set or unset from the end user. * Using the helper error functions inside the project service. * Correct usage of hclog, replace panic with Error log. * Adding periods to all API returned errors, correct spelling, fix missed invalid argument error not using helper function. * Change our logged errors to Error instead of Warn. * Add TODO for defining and using our own defined API error codes. * Add TODO to remove internal error messages.
25 lines
755 B
Protocol Buffer
25 lines
755 B
Protocol Buffer
syntax = "proto3";
|
|
|
|
package controller.api.v1;
|
|
|
|
option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api;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"];
|
|
}
|
|
|
|
// 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;
|
|
// 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.
|
|
ErrorDetails details = 4;
|
|
}
|