vendor/bundle/ruby/2.6.0/gems/w3c_validators-1.3.7/lib/w3c_validators/validator.rb
def handle_exception(e, msg = '') # :nodoc:
      if USE_NEW_EXCEPTION
        http_exception = Net::HTTPClientException
      else
        http_exception = Net::HTTPServerException
      end
      case e
        when http_exception, SocketError, Errno::ECONNREFUSED
          msg = "unable to connect to the validator at #{@validator_uri} (response was #{e.message})."
          raise ValidatorUnavailable, msg, caller
        when JSON::ParserError, Nokogiri::XML::SyntaxError
          msg = "unable to parse the response from the validator."
          raise ParsingError, msg, caller
        else
          raise e
      end

      if e.respond_to?(:error_handler_before)
        fcall(e, :error_handler_before, self)
      end

      if e.respond_to?(:error_handler_instead)
        fcall(e, :error_handler_instead, self)
      else
        if e.respond_to? :status
          exit_status(( e.status ))
        end

        if SystemExit === e
          stderr.puts e.message unless(SystemExit === e and e.message.to_s == 'exit') ### avoids double message for abort('message')
        end
      end

      if e.respond_to?(:error_handler_after)
        fcall(e, :error_handler_after, self)
      end

      exit_status(( exit_failure )) if exit_status == exit_success
      exit_status(( Integer(exit_status) rescue(exit_status ? 0 : 1) ))
      exit exit_status
    end
#--
# Big thanks to ara.t.howard and Joel VanderWerf on Ruby-Talk for the exception handling help.
#++
Big thanks to ara.t.howard and Joel VanderWerf on Ruby-Talk for the exception handling help.
Big thanks to ara . t . howard and Joel VanderWerf on Ruby - Talk for the exception handling help .
def handle_exception(e, msg = '') 
      if USE_NEW_EXCEPTION
        http_exception = Net::HTTPClientException
      else
        http_exception = Net::HTTPServerException
      end
      case e
        when http_exception, SocketError, Errno::ECONNREFUSED
          msg = "unable to connect to the validator at #{@validator_uri} (response was #{e.message})."
          raise ValidatorUnavailable, msg, caller
        when JSON::ParserError, Nokogiri::XML::SyntaxError
          msg = "unable to parse the response from the validator."
          raise ParsingError, msg, caller
        else
          raise e
      end
      if e.respond_to?(:error_handler_before)
        fcall(e, :error_handler_before, self)
      end
      if e.respond_to?(:error_handler_instead)
        fcall(e, :error_handler_instead, self)
      else
        if e.respond_to? :status
          exit_status(( e.status ))
        end
        if SystemExit === e
          stderr.puts e.message unless(SystemExit === e and e.message.to_s == 'exit') 
        end
      end
      if e.respond_to?(:error_handler_after)
        fcall(e, :error_handler_after, self)
      end
      exit_status(( exit_failure )) if exit_status == exit_success
      exit_status(( Integer(exit_status) rescue(exit_status ? 0 : 1) ))
      exit exit_status
    end
def handle_exception ( e , msg = '' ) if USE_NEW_EXCEPTION http_exception = Net :: HTTPClientException else http_exception = Net :: HTTPServerException end case e when http_exception , SocketError , Errno :: ECONNREFUSED msg = "unable to connect to the validator at #{@validator_uri} (response was #{e.message})." raise ValidatorUnavailable , msg , caller when JSON :: ParserError , Nokogiri :: XML :: SyntaxError msg = "unable to parse the response from the validator." raise ParsingError , msg , caller else raise e end if e . respond_to? ( :error_handler_before ) fcall ( e , :error_handler_before , self ) end if e . respond_to? ( :error_handler_instead ) fcall ( e , :error_handler_instead , self ) else if e . respond_to? :status exit_status ( ( e . status ) ) end if SystemExit === e stderr . puts e . message unless ( SystemExit === e and e . message . to_s == 'exit' ) end end if e . respond_to? ( :error_handler_after ) fcall ( e , :error_handler_after , self ) end exit_status ( ( exit_failure ) ) if exit_status == exit_success exit_status ( ( Integer ( exit_status ) rescue ( exit_status ? 0 : 1 ) ) ) exit exit_status end
Big thanks to ara.t.howard and Joel VanderWerf on Ruby-Talk for the exception handling help.
Big thanks to ara . t . howard and Joel VanderWerf on Ruby - Talk for the exception handling help .
# :nodoc: ### avoids double message for abort('message')
e
msg