Sha256: b6ff91c7923d75c67166ebc417ddb4f18a6166c9c0d76efdaf744f7369d566d5
Contents?: true
Size: 819 Bytes
Versions: 28
Compression:
Stored size: 819 Bytes
Contents
# frozen_string_literal: true module AnyCable module Middlewares class Exceptions < AnyCable::Middleware def call(method_name, request, _meta) yield rescue => exp notify_exception(exp, method_name, request) response_class(method_name).new( status: AnyCable::Status::ERROR, error_msg: exp.message ) end private def notify_exception(exp, method_name, request) AnyCable::ExceptionsHandling.notify(exp, method_name.to_s, request.to_h) end def response_class(method_name) case method_name when :connect AnyCable::ConnectionResponse when :disconnect AnyCable::DisconnectResponse else AnyCable::CommandResponse end end end end end
Version data entries
28 entries across 28 versions & 1 rubygems