Module: Snarl::SNP::Error
- Defined in:
- lib/snarl/snp/error.rb
Defined Under Namespace
Classes: Casual, Fatal, RUBYSNARL_UNKNOWN_RESPONSE, SNPError, SNP_ERROR_ALREADY_REGISTERED, SNP_ERROR_BAD_PACKET, SNP_ERROR_CLASS_ALREADY_EXISTS, SNP_ERROR_FAILED, SNP_ERROR_NOT_REGISTERED, SNP_ERROR_NOT_RUNNING, SNP_ERROR_TIMED_OUT, SNP_ERROR_UNKNOWN_COMMAND, SNP_OK
Constant Summary collapse
- CODE_TO_OBJ =
(???) Snarl returns unknown return code.
{ '0' => SNP_OK, '101' => SNP_ERROR_FAILED, '102' => SNP_ERROR_UNKNOWN_COMMAND, '103' => SNP_ERROR_TIMED_OUT, '107' => SNP_ERROR_BAD_PACKET, '201' => SNP_ERROR_NOT_RUNNING, '202' => SNP_ERROR_NOT_REGISTERED, '203' => SNP_ERROR_ALREADY_REGISTERED, '204' => SNP_ERROR_CLASS_ALREADY_EXISTS }
Class Method Summary collapse
Class Method Details
.klass(response, request = nil) ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/snarl/snp/error.rb', line 61 def self.klass(response, request=nil) if klass = Error::CODE_TO_OBJ[response.to_s] then klass elsif response.kind_of?(Error::SNPError) response else Error::RUBYSNARL_UNKNOWN_RESPONSE end end |