Sha256: 31280edf5b1e607b1a1b938b9ea53c4802b6df0c160213a70d5b139a4fdd207c
Contents?: true
Size: 1.74 KB
Versions: 2
Compression:
Stored size: 1.74 KB
Contents
module Teaspoon class Error < Exception; end class EnvironmentNotFound < Teaspoon::Error; end class MissingDependency < Teaspoon::Error; end class ServerException < Teaspoon::Error; end class RunnerException < Teaspoon::Error; end class ExporterException < Teaspoon::Error; end class UnknownFramework < Teaspoon::Error; end class UnknownCoverage < Teaspoon::Error; end class UnknownDriver < Teaspoon::Error; end class UnknownDriverOptions < Teaspoon::Error; end class UnknownFormatter < Teaspoon::Error; end class UnknownSuite < Teaspoon::Error; end class AssetNotServable < Teaspoon::Error; end class Failure < Teaspoon::Error; end class DependencyFailure < Teaspoon::Error; end class ThresholdNotMet < Teaspoon::Error; end class FileNotWritable < Teaspoon::Error; end module ExceptionHandling def self.add_rails_handling return unless Teaspoon.configuration.driver == "phantomjs" # debugging should be off to display errors in the suite_controller # Rails.application.config.assets.debug = false # we want rails to display exceptions Rails.application.config.action_dispatch.show_exceptions = true # override the render exception method in ActionDispatch to raise a javascript exception render_exceptions_with_javascript end private def self.render_exceptions_with_javascript ActionDispatch::DebugExceptions.class_eval do def render_exception(_env, exception) message = "#{exception.class.name}: #{exception.message}" body = "<script>throw Error(#{[message, exception.backtrace].join("\n").inspect})</script>" [200, { "Content-Type" => "text/html;", "Content-Length" => body.bytesize.to_s }, [body]] end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
teaspoon-0.9.1 | lib/teaspoon/exceptions.rb |
teaspoon-0.9.0 | lib/teaspoon/exceptions.rb |