Class: Fabric::ErrorFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/fabric/error.rb

Constant Summary collapse

CHAINCODE_ERROR_MESSAGE_PREFIX =
'transaction returned with failure:'.freeze

Class Method Summary collapse

Class Method Details

.create(message) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fabric/error.rb', line 5

def self.create(message)
  if message.start_with? CHAINCODE_ERROR_MESSAGE_PREFIX
    ChaincodeError.new message.gsub(CHAINCODE_ERROR_MESSAGE_PREFIX, '')
  else
    UnknownError.new message
  end
end