Documentation ¶
Overview ¶
Package status defines metadata for errors returned by fabric-sdk-go. This information may be used by SDK users to make decisions about how to handle certain error conditions.
Index ¶
- Variables
- func ToFabricCommonStatusCode(c int32) common.Status
- func ToGRPCStatusCode(c int32) grpcCodes.Code
- func ToOrdererStatusCode(c int32) common.Status
- func ToPeerStatusCode(c int32) common.Status
- func ToTransactionValidationCode(c int32) pb.TxValidationCode
- type ChaincodeStatus
- type Code
- type Group
- type Status
- func FromError(err error) (s *Status, ok bool)
- func New(group Group, code int32, msg string, details []interface{}) *Status
- func NewFromExtractedChaincodeError(code int, message string) *Status
- func NewFromGRPCStatus(s *grpcstatus.Status) *Status
- func NewFromProposalResponse(res *pb.ProposalResponse, endorser string) *Status
Constants ¶
This section is empty.
Variables ¶
var CodeName = map[int32]string{
0: "OK",
1: "UNKNOWN",
2: "CONNECTION_FAILED",
3: "ENDORSEMENT_MISMATCH",
4: "EMPTY_CERT",
5: "TIMEOUT",
6: "NO_PEERS_FOUND",
7: "MULTIPLE_ERRORS",
8: "SIGNATURE_VERIFICATION_FAILED",
9: "MISSING_ENDORSEMENT",
10: "CHAINCODE_ERROR",
21: "NO_MATCHING_CERTIFICATE_AUTHORITY_ENTITY",
22: "NO_MATCHING_PEER_ENTITY",
23: "NO_MATCHING_ORDERER_ENTITY",
}
CodeName maps the codes in this packages to human-readable strings
var GroupName = map[int32]string{
0: "Unknown",
1: "gRPC Transport Status",
2: "HTTP Transport Status",
3: "Endorser Server Status",
4: "Event Server Status",
5: "Orderer Server Status",
6: "Fabric CA Server Status",
7: "Endorser Client Status",
8: "Orderer Client Status",
9: "Client Status",
}
GroupName maps the groups in this packages to human-readable strings
Functions ¶
func ToFabricCommonStatusCode ¶
ToFabricCommonStatusCode cast to common.Status
func ToGRPCStatusCode ¶
ToGRPCStatusCode cast to gRPC status code
func ToOrdererStatusCode ¶
ToOrdererStatusCode cast to peer status
func ToPeerStatusCode ¶
ToPeerStatusCode cast to peer status
func ToTransactionValidationCode ¶
func ToTransactionValidationCode(c int32) pb.TxValidationCode
ToTransactionValidationCode cast to transaction validation status code
Types ¶
type ChaincodeStatus ¶
ChaincodeStatus is for extracting Code and message from chaincode GRPC errors
type Code ¶
type Code uint32
Code represents a status code
const ( // OK is returned on success. OK Code = 0 // Unknown represents status codes that are uncategorized or unknown to the SDK Unknown Code = 1 // ConnectionFailed is returned when a network connection attempt from the SDK fails ConnectionFailed Code = 2 // EndorsementMismatch is returned when there is a mismatch in endorsements received by the SDK EndorsementMismatch Code = 3 // EmptyCert is return when an empty cert is returned EmptyCert Code = 4 // Timeout operation timed out Timeout Code = 5 // NoPeersFound No peers were discovered/configured NoPeersFound Code = 6 // MultipleErrors multiple errors occurred MultipleErrors Code = 7 // SignatureVerificationFailed is when signature fails verification SignatureVerificationFailed Code = 8 // MissingEndorsement is if an endoresement is missing MissingEndorsement Code = 9 // ChaincodeError is for errors returned by Chaincode ChaincodeError Code = 10 // NoMatchingCertificateAuthorityEntity is if entityMatchers are unable to find any matchingCertificateAuthority NoMatchingCertificateAuthorityEntity Code = 21 // NoMatchingPeerEntity is if entityMatchers are unable to find any matchingPeer NoMatchingPeerEntity Code = 22 // NoMatchingOrdererEntity is if entityMatchers are unable to find any matchingOrderer NoMatchingOrdererEntity Code = 23 )
func ToSDKStatusCode ¶
ToSDKStatusCode cast to fabric-sdk-go status code
type Group ¶
type Group int32
Group of status to help users infer status codes from various components
const ( // UnknownStatus unknown status group UnknownStatus Group = iota // GRPCTransportStatus is the status associated with requests made over // gRPC connections GRPCTransportStatus // HTTPTransportStatus is the status associated with requests made over HTTP // connections HTTPTransportStatus // EndorserServerStatus status returned by the endorser server EndorserServerStatus // EventServerStatus status returned by the eventhub EventServerStatus // OrdererServerStatus status returned by the ordering service OrdererServerStatus // FabricCAServerStatus status returned by the Fabric CA server FabricCAServerStatus // EndorserClientStatus status returned from the endorser client EndorserClientStatus // OrdererClientStatus status returned from the orderer client OrdererClientStatus // ClientStatus is a generic client status ClientStatus )
type Status ¶
type Status struct { // Group status group Group Group // Code status code Code int32 // Message status message Message string // Details any additional status details Details []interface{} }
Status provides additional information about an unsuccessful operation performed by fabric-sdk-go. Essentially, this object contains metadata about an error returned by the SDK.
func FromError ¶
FromError returns a Status representing err if available, otherwise it returns nil, false.
func NewFromExtractedChaincodeError ¶
NewFromExtractedChaincodeError returns Status when an error occurs in GRPC Transport
func NewFromGRPCStatus ¶
func NewFromGRPCStatus(s *grpcstatus.Status) *Status
NewFromGRPCStatus new Status from gRPC status response
func NewFromProposalResponse ¶
func NewFromProposalResponse(res *pb.ProposalResponse, endorser string) *Status
NewFromProposalResponse creates a status created from the given ProposalResponse