github.com/kchristidis/fabric@v1.0.4-0.20171028114726-837acd08cde1/common/errors/codes.go (about)

     1  /*
     2   Copyright Digital Asset Holdings, LLC 2016 All Rights Reserved.
     3   Copyright IBM Corp. 2017 All Rights Reserved.
     4  
     5   Licensed under the Apache License, Version 2.0 (the "License");
     6   you may not use this file except in compliance with the License.
     7   You may obtain a copy of the License at
     8  
     9        http://www.apache.org/licenses/LICENSE-2.0
    10  
    11   Unless required by applicable law or agreed to in writing, software
    12   distributed under the License is distributed on an "AS IS" BASIS,
    13   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   See the License for the specific language governing permissions and
    15   limitations under the License.
    16  */
    17  
    18  package errors
    19  
    20  // A set of constants for error reason codes, which is based on HTTP codes
    21  // http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
    22  const (
    23  	// Invalid inputs on API calls
    24  	BadRequest = "400"
    25  
    26  	// Forbidden due to access control issues
    27  	Forbidden = "403"
    28  
    29  	// Not Found (eg chaincode not found)
    30  	NotFound = "404"
    31  
    32  	// Request timeout (chaincode or ledger)
    33  	Timeout = "408"
    34  
    35  	// Example, duplicate transactions or replay attacks
    36  	Conflict = "409"
    37  
    38  	// Request for resource is not available. Example, a chaincode has
    39  	// been upgraded and the request uses an old version
    40  	Gone = "410"
    41  
    42  	// Payload of the request exceeds allowed size
    43  	PayloadTooLarge = "413"
    44  
    45  	// Example, marshal/unmarshalling protobuf error
    46  	UnprocessableEntity = "422"
    47  
    48  	// Protocol version is no longer supported
    49  	UpgradeRequired = "426"
    50  
    51  	// Internal server errors that are not classified below
    52  	Internal = "500"
    53  
    54  	// Requested chaincode function has not been implemented
    55  	NotImplemented = "501"
    56  
    57  	// Requested chaincode is not available
    58  	Unavailable = "503"
    59  
    60  	// File IO errors
    61  	FileIO = "520"
    62  
    63  	// Network IO errors
    64  	NetworkIO = "521"
    65  )
    66  
    67  // A set of constants for component codes
    68  const (
    69  	// BCCSP is fabic/BCCSP
    70  	BCCSP = "CSP"
    71  
    72  	// Common is fabric/common
    73  	Common = "CMN"
    74  
    75  	// Core is fabric/core
    76  	Core = "COR"
    77  
    78  	// Event is fabric/events component
    79  	Event = "EVT"
    80  
    81  	// Gossip is fabric/gossip
    82  	Gossip = "GSP"
    83  
    84  	// Ledger is fabric/core/ledger
    85  	Ledger = "LGR"
    86  
    87  	// Peer is fabric/peer
    88  	Peer = "PER"
    89  
    90  	// Orderer is fabric/orderer
    91  	Orderer = "ORD"
    92  
    93  	// MSP is fabric/msp
    94  	MSP = "MSP"
    95  
    96  	// ChaincodeSupport is fabric/core/chaincode
    97  	ChaincodeSupport = "CCS"
    98  
    99  	// DeliveryService is fabric/core/deliverservice
   100  	DeliveryService = "CDS"
   101  
   102  	// SystemChaincode is fabric/core/scc (system chaincode)
   103  	SystemChaincode = "SCC"
   104  )