class StickyElephant::Handler::Error
Constants
- ERROR_CODES
- ERROR_RESPONSE_SEVERITY
Public Instance Methods
process()
click to toggle source
# File lib/sticky_elephant/handler/error.rb, line 4 def process socket.write(handshake_error) end
Private Instance Methods
error_response_for(severity: :error, code: , message: , file: , line:, routine: )
click to toggle source
# File lib/sticky_elephant/handler/error.rb, line 50 def error_response_for(severity: :error, code: , message: , file: , line:, routine: ) severity = severity.to_sym unless ERROR_RESPONSE_SEVERITY.include? severity raise ArgumentError.new("Severity #{severity} not in #{ERROR_RESPONSE_SEVERITY.keys.join(', ')}") end unless ERROR_CODES.include? code.to_s raise ArgumentError.new("Code #{code} not in code list") end error_payload = [ "S#{ERROR_RESPONSE_SEVERITY.fetch(severity)}", "C#{code}", "M#{message}", "F#{file}", "L#{line}", "R#{routine}\x00" ].map {|s| "#{s}\x00"}.join "E" + with_length_bytes(error_payload) end
handshake_error()
click to toggle source
# File lib/sticky_elephant/handler/error.rb, line 10 def handshake_error error_response_for( severity: :error, code: "0A000", message: "unsupported frontend protocol 65363.19778: server supports 1.0 to 3.0", file: "postmaster.c", line: "2005", routine: "ProcessStartupPacket" ) end