Adjust error info
This commit is contained in:
parent
ebc381a760
commit
f9452659ca
28
bdchain/api/error_details.proto
Normal file
28
bdchain/api/error_details.proto
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package bdchain.api;
|
||||||
|
|
||||||
|
option go_package = "bdchain/api/grpc/common";
|
||||||
|
option java_package = "bdchain.api.grpc";
|
||||||
|
option java_outer_classname = "CommonProto";
|
||||||
|
option java_multiple_files = true;
|
||||||
|
|
||||||
|
// InvalidArgument indicates client specified an invalid argument.
|
||||||
|
// Note that this differs from FailedPrecondition. It indicates arguments
|
||||||
|
// that are problematic regardless of the state of the system
|
||||||
|
// (e.g., a malformed file name).
|
||||||
|
message InvalidArgument {
|
||||||
|
// A message type used to describe a single invalid field.
|
||||||
|
message FieldViolation {
|
||||||
|
// A path leading to a field in the request body. The value will be a
|
||||||
|
// sequence of dot-separated identifiers that identify a protocol buffer
|
||||||
|
// field. E.g., "field_violations.field" would identify this field.
|
||||||
|
string field = 1;
|
||||||
|
|
||||||
|
// A description of why the request element is bad.
|
||||||
|
string description = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Describes all violations in a client request.
|
||||||
|
repeated FieldViolation field_violations = 1;
|
||||||
|
}
|
1
gen.bat
1
gen.bat
@ -10,6 +10,7 @@ where /q %gen% || echo missing %gen% && exit /B
|
|||||||
|
|
||||||
if not exist %dir% mkdir %dir%
|
if not exist %dir% mkdir %dir%
|
||||||
%exe% -I . --go_out=plugins=grpc:%dir% bdchain/api/common.proto
|
%exe% -I . --go_out=plugins=grpc:%dir% bdchain/api/common.proto
|
||||||
|
%exe% -I . --go_out=plugins=grpc:%dir% bdchain/api/error_details.proto
|
||||||
%exe% -I . --go_out=plugins=grpc:%dir% bdchain/api/tx_ledger.proto
|
%exe% -I . --go_out=plugins=grpc:%dir% bdchain/api/tx_ledger.proto
|
||||||
%exe% -I . --go_out=plugins=grpc:%dir% bdchain/api/ac_chain.proto
|
%exe% -I . --go_out=plugins=grpc:%dir% bdchain/api/ac_chain.proto
|
||||||
|
|
||||||
|
1
gen.sh
1
gen.sh
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
mkdir -p gen/go
|
mkdir -p gen/go
|
||||||
protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/common.proto
|
protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/common.proto
|
||||||
|
protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/error_details.proto
|
||||||
protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/tx_ledger.proto
|
protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/tx_ledger.proto
|
||||||
protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/ac_chain.proto
|
protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/ac_chain.proto
|
||||||
|
13
test.md
13
test.md
@ -236,14 +236,13 @@ transaction:
|
|||||||
**Error**
|
**Error**
|
||||||
```yaml
|
```yaml
|
||||||
code: Code.InvalidArgument
|
code: Code.InvalidArgument
|
||||||
message: 'Multiple errors in transaction'
|
message: 'Multiple invalid arguments'
|
||||||
details:
|
details:
|
||||||
- code: Code.InvalidArgument
|
- field_violations: (of type InvalidArgument)
|
||||||
message: 'from must not be empty'
|
- field: 'transaction.from'
|
||||||
details:
|
description: 'from must not be empty'
|
||||||
- code: Code.InvalidArgument
|
- field: 'transaction.to'
|
||||||
message: 'to must be a valid 32-byte address'
|
description: 'to must be a valid 32-byte address'
|
||||||
details:
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
Loading…
Reference in New Issue
Block a user