Skip to content

Commit

Permalink
refactor(logic)!: enhance answer responses for error cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel committed Feb 26, 2024
1 parent 7879f80 commit 16698c3
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 147 deletions.
17 changes: 8 additions & 9 deletions proto/logic/v1beta2/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ message Substitution {
message Result {
option (gogoproto.goproto_stringer) = true;

// error specifies the error message if the query caused an error.
string error = 5 [
(gogoproto.nullable) = true,
(gogoproto.moretags) = "yaml:\"error\",omitempty"
];

// substitutions represent all the substitutions made to the variables in the query to obtain the answer.
repeated Substitution substitutions = 1 [
repeated Substitution substitutions = 2 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"substitutions\",omitempty"
];
Expand All @@ -31,18 +37,11 @@ message Result {
message Answer {
option (gogoproto.goproto_stringer) = true;

// success specifies if the query was successful.
bool success = 1 [(gogoproto.moretags) = "yaml:\"success\",omitempty"];
// error specifies the error message if the query caused an error.
string error = 5 [
(gogoproto.nullable) = true,
(gogoproto.moretags) = "yaml:\"error\",omitempty"
];
// has_more specifies if there are more solutions than the ones returned.
bool has_more = 2 [(gogoproto.moretags) = "yaml:\"has_more\",omitempty"];
// variables represent all the variables in the query.
repeated string variables = 3 [
(gogoproto.nullable) = true,
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"variables\",omitempty"
];
// results represent all the results of the query.
Expand Down
207 changes: 82 additions & 125 deletions x/logic/types/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 16698c3

Please sign in to comment.