class Cassandra::Protocol::ErrorResponse
Attributes
code[R]
custom_payload[R]
message[R]
warnings[R]
Public Class Methods
new(*args)
click to toggle source
# File lib/cassandra/protocol/responses/error_response.rb 27 def initialize(*args) 28 @custom_payload, @warnings, @code, @message = args 29 end
Public Instance Methods
to_error(keyspace, statement, options, hosts, consistency, retries)
click to toggle source
# File lib/cassandra/protocol/responses/error_response.rb 36 def to_error(keyspace, statement, options, hosts, consistency, retries) 37 case @code 38 when 0x0000 then Errors::ServerError.new(@message, 39 @custom_payload, 40 @warnings, 41 keyspace, 42 statement, 43 options, 44 hosts, 45 consistency, 46 retries) 47 when 0x000A then Errors::ProtocolError.new(@message, 48 @custom_payload, 49 @warnings, 50 keyspace, 51 statement, 52 options, 53 hosts, 54 consistency, 55 retries) 56 when 0x0100 then Errors::AuthenticationError.new(@message, 57 @custom_payload, 58 @warnings, 59 keyspace, 60 statement, 61 options, 62 hosts, 63 consistency, 64 retries) 65 when 0x1001 then Errors::OverloadedError.new(@message, 66 @custom_payload, 67 @warnings, 68 keyspace, 69 statement, 70 options, 71 hosts, 72 consistency, 73 retries) 74 when 0x1002 then Errors::IsBootstrappingError.new(@message, 75 @custom_payload, 76 @warnings, 77 keyspace, 78 statement, 79 options, 80 hosts, 81 consistency, 82 retries) 83 when 0x1003 then Errors::TruncateError.new(@message, 84 @custom_payload, 85 @warnings, 86 keyspace, 87 statement, 88 options, 89 hosts, 90 consistency, 91 retries) 92 when 0x2000 then Errors::SyntaxError.new(@message, 93 @custom_payload, 94 @warnings, 95 keyspace, 96 statement, 97 options, 98 hosts, 99 consistency, 100 retries) 101 when 0x2100 then Errors::UnauthorizedError.new(@message, 102 @custom_payload, 103 @warnings, 104 keyspace, 105 statement, 106 options, 107 hosts, 108 consistency, 109 retries) 110 when 0x2200 then Errors::InvalidError.new(@message, 111 @custom_payload, 112 @warnings, 113 keyspace, 114 statement, 115 options, 116 hosts, 117 consistency, 118 retries) 119 when 0x2300 then Errors::ConfigurationError.new(@message, 120 @custom_payload, 121 @warnings, 122 keyspace, 123 statement, 124 options, 125 hosts, 126 consistency, 127 retries) 128 else 129 Errors::ServerError.new(@message, 130 @custom_payload, 131 @warnings, 132 keyspace, 133 statement, 134 options, 135 hosts, 136 consistency, 137 retries) 138 end 139 end
to_s()
click to toggle source
# File lib/cassandra/protocol/responses/error_response.rb 31 def to_s 32 hex_code = @code.to_s(16).rjust(4, '0').upcase 33 %(ERROR 0x#{hex_code} "#{@message}") 34 end