### Home Classes Methods

### In Files

- lib/merb-core/dispatch/default_exception/default_exception.rb

### Methods

- #error_codes
- #frame_details
- #humanize_exception
- #jar?
- #listing
- #render_source
- #textmate_url

### Files

- CHANGELOG
- LICENSE
- README
- TODO

### Class/Module Index

Quicksearch

- Merb
- Merb::AbstractController
- Merb::AcceptType
- Merb::AuthenticationMixin
- Merb::AuthenticationMixin::BasicAuthentication
- Merb::BootLoader
- Merb::BootLoader::AfterAppLoads
- Merb::BootLoader::BackgroundServices
- Merb::BootLoader::BeforeAppLoads
- Merb::BootLoader::BuildFramework
- Merb::BootLoader::ChooseAdapter
- Merb::BootLoader::Cookies
- Merb::BootLoader::Defaults
- Merb::BootLoader::Dependencies
- Merb::BootLoader::DropPidFile
- Merb::BootLoader::LoadClasses
- Merb::BootLoader::Logger
- Merb::BootLoader::MimeTypes
- Merb::BootLoader::MixinSession
- Merb::BootLoader::RackUpApplication
- Merb::BootLoader::ReloadClasses
- Merb::BootLoader::ReloadClasses::TimedExecutor
- Merb::BootLoader::Router
- Merb::BootLoader::SetupSession
- Merb::BootLoader::SetupStubClasses
- Merb::BootLoader::Templates
- Merb::ConditionalGetMixin
- Merb::Config
- Merb::Config::ConfigBlock
- Merb::Const
- Merb::Controller
- Merb::ControllerExceptions
- Merb::ControllerExceptions::Accepted
- Merb::ControllerExceptions::ActionNotFound
- Merb::ControllerExceptions::BadGateway
- Merb::ControllerExceptions::BadRequest
- Merb::ControllerExceptions::Base
- Merb::ControllerExceptions::ClientError
- Merb::ControllerExceptions::Conflict
- Merb::ControllerExceptions::Continue
- Merb::ControllerExceptions::Created
- Merb::ControllerExceptions::ExpectationFailed
- Merb::ControllerExceptions::Forbidden
- Merb::ControllerExceptions::GatewayTimeout
- Merb::ControllerExceptions::Gone
- Merb::ControllerExceptions::HTTPVersionNotSupported
- Merb::ControllerExceptions::Informational
- Merb::ControllerExceptions::InternalServerError
- Merb::ControllerExceptions::LayoutNotFound
- Merb::ControllerExceptions::LengthRequired
- Merb::ControllerExceptions::MethodNotAllowed
- Merb::ControllerExceptions::MovedPermanently
- Merb::ControllerExceptions::MovedTemporarily
- Merb::ControllerExceptions::MultiPartParseError
- Merb::ControllerExceptions::MultipleChoices
- Merb::ControllerExceptions::NoContent
- Merb::ControllerExceptions::NonAuthoritativeInformation
- Merb::ControllerExceptions::NotAcceptable
- Merb::ControllerExceptions::NotFound
- Merb::ControllerExceptions::NotImplemented
- Merb::ControllerExceptions::NotModified
- Merb::ControllerExceptions::OK
- Merb::ControllerExceptions::PartialContent
- Merb::ControllerExceptions::PaymentRequired
- Merb::ControllerExceptions::PreconditionFailed
- Merb::ControllerExceptions::ProxyAuthenticationRequired
- Merb::ControllerExceptions::Redirection
- Merb::ControllerExceptions::RequestEntityTooLarge
- Merb::ControllerExceptions::RequestRangeNotSatisfiable
- Merb::ControllerExceptions::RequestTimeout
- Merb::ControllerExceptions::RequestURITooLarge
- Merb::ControllerExceptions::ResetContent
- Merb::ControllerExceptions::SeeOther
- Merb::ControllerExceptions::ServerError
- Merb::ControllerExceptions::ServiceUnavailable
- Merb::ControllerExceptions::Successful
- Merb::ControllerExceptions::SwitchingProtocols
- Merb::ControllerExceptions::TemplateNotFound
- Merb::ControllerExceptions::TemporaryRedirect
- Merb::ControllerExceptions::Unauthorized
- Merb::ControllerExceptions::UnsupportedMediaType
- Merb::ControllerExceptions::UseProxy
- Merb::ControllerMixin
- Merb::CookieSession
- Merb::CookieSession::CookieOverflow
- Merb::CookieSession::TamperedWithCookie
- Merb::Cookies
- Merb::CookiesMixin
- Merb::CookiesMixin::RequestMixin
- Merb::Counter
- Merb::Dispatcher
- Merb::Dispatcher::DefaultException
- Merb::Dispatcher::DefaultExceptionHelper
- Merb::GlobalHelpers
- Merb::InlineTemplates
- Merb::Logger
- Merb::MemcacheSession
- Merb::MemcacheStore
- Merb::MemorySession
- Merb::MemorySessionStore
- Merb::Parse
- Merb::Plugins
- Merb::Rack
- Merb::Rack::AbstractAdapter
- Merb::Rack::Adapter
- Merb::Rack::Application
- Merb::Rack::ConditionalGet
- Merb::Rack::Console
- Merb::Rack::ContentLength
- Merb::Rack::DeferrableMiddleware
- Merb::Rack::Ebb
- Merb::Rack::EventedMongrel
- Merb::Rack::FastCGI
- Merb::Rack::Handler
- Merb::Rack::Handler::Mongrel
- Merb::Rack::Head
- Merb::Rack::Helpers
- Merb::Rack::Irb
- Merb::Rack::Middleware
- Merb::Rack::Mongrel
- Merb::Rack::PathPrefix
- Merb::Rack::Profiler
- Merb::Rack::Runner
- Merb::Rack::Static
- Merb::Rack::StreamWrapper
- Merb::Rack::SwiftipliedMongrel
- Merb::Rack::Thin
- Merb::Rack::ThinTurbo
- Merb::Rack::Tracer
- Merb::Rack::WEBrick
- Merb::RenderMixin
- Merb::RenderMixin::ClassMethods
- Merb::Request
- Merb::ReservedError
- Merb::Responder
- Merb::ResponderMixin
- Merb::ResponderMixin::ClassMethods
- Merb::ResponderMixin::ContentTypeAlreadySet
- Merb::Router
- Merb::Router::Behavior
- Merb::Router::Behavior::Error
- Merb::Router::Behavior::Proxy
- Merb::Router::CachedProc
- Merb::Router::GenerationError
- Merb::Router::NotCompiledError
- Merb::Router::Resources
- Merb::Router::RouteNotFound
- Merb::Server
- Merb::Session
- Merb::SessionContainer
- Merb::SessionMixin
- Merb::SessionMixin::NoSessionContainer
- Merb::SessionMixin::RequestMixin
- Merb::SessionMixin::RequestMixin::ClassMethods
- Merb::SessionMixin::SessionOverflow
- Merb::SessionStoreContainer
- Merb::System
- Merb::System::PortablePoller
- Merb::Template
- Merb::Template::Erubis
- Merb::Template::Erubis::Mixin
- Merb::Test
- Merb::Test::ControllerHelper
- Merb::Test::Cookie
- Merb::Test::CookieJar
- Merb::Test::ExampleGroup
- Merb::Test::Helpers
- Merb::Test::MakeRequest
- Merb::Test::Matchers
- Merb::Test::MultipartRequestHelper
- Merb::Test::MultipartRequestHelper::FileParam
- Merb::Test::MultipartRequestHelper::Param
- Merb::Test::MultipartRequestHelper::Post
- Merb::Test::RequestHelper
- Merb::Test::RequestHelper::CookieJar
- Merb::Test::RequestHelper::FakeRequest
- Merb::Test::RouteHelper
- Merb::Test::Rspec
- Merb::Test::Rspec::ControllerMatchers
- Merb::Test::Rspec::ControllerMatchers::BeError
- Merb::Test::Rspec::ControllerMatchers::BeRedirect
- Merb::Test::Rspec::ControllerMatchers::Provide
- Merb::Test::Rspec::RouteMatchers
- Merb::Test::Rspec::RouteMatchers::ParameterMatcher
- Merb::Test::Rspec::RouteMatchers::RouteToMatcher
- Merb::Test::ViewHelper
- Merb::Test::WebratHelper
- Merb::Worker
- Erubis
- Erubis::Basic
- Erubis::Basic::Converter
- Erubis::BlockAwareEnhancer
- Erubis::BlockAwareEruby
- Erubis::MEruby
- Spec
- Spec::Matchers
- Spec::Matchers::MatcherDSL
- Spec::Runner
- Spec::Runner::Formatter
- Spec::Runner::Formatter::BaseTextFormatter
- Gem
- Gem::Dependency
- Hpricot
- Hpricot::Elem
- Mongrel
- Mongrel::HttpResponse
- Class
- Exception
- Hash
- Kernel
- MemCache
- Memcached
- Object
- String
- Time

No matching classes.

# Merb::Dispatcher::DefaultExceptionHelper

:api: private

### Public Instance Methods

error_codes(exception) click to toggle source

:api: private

    # File lib/merb-core/dispatch/default_exception/default_exception.rb, line 13
    def error_codes(exception)
      if @show_details
        message, message_details = exception.message.split("\n", 2)
        "<h2>#{escape_html(message)}</h2><p>#{escape_html(message_details)}</p>"
      else
        "<h2>Sorry about that...</h2>"
      end
    end

frame_details(line) click to toggle source

:api: private

    # File lib/merb-core/dispatch/default_exception/default_exception.rb, line 23
    def frame_details(line)
      if (match = line.match(/^(.+):(\d+):(.+)$/))
        filename = match[1]
        lineno = match[2]
        location = match[3]
        if filename.index(Merb.framework_root) == 0
          type = "framework"
          shortname = Pathname.new(filename).relative_path_from(Pathname.new(Merb.framework_root))
        elsif filename.index(Merb.root) == 0
          type = "app"
          shortname = Pathname.new(filename).relative_path_from(Pathname.new(Merb.root))
        elsif Module.const_defined?(:Gem) && Gem.respond_to?(:path) && path = Gem.path.find {|p| filename.index(p) == 0}
          type = "gem"
          shortname = Pathname.new(filename).relative_path_from(Pathname.new(path))
        else
          type = "other"
          shortname = filename
        end
        [type, shortname, filename, lineno, location]
      else
        ['', '', '', nil, nil]
      end
    end

humanize_exception(e) click to toggle source

:api: private

    # File lib/merb-core/dispatch/default_exception/default_exception.rb, line 8
    def humanize_exception(e)
      e.class.name.split("::").last.gsub(/([a-z])([A-Z])/, '\1 \2')
    end

jar?(filename) click to toggle source

    # File lib/merb-core/dispatch/default_exception/default_exception.rb, line 67
    def jar?(filename)
      filename.match(/jar\!/)
    end

listing(key, value, arr) click to toggle source

:api: private

    # File lib/merb-core/dispatch/default_exception/default_exception.rb, line 48
    def listing(key, value, arr)
      ret   =  []
      ret   << "<table class=\"listing\" style=\"display: none\">"
      ret   << "  <thead>"
      ret   << "    <tr><th width='25%'>#{key}</th><th width='75%'>#{value}</th></tr>"
      ret   << "  </thead>"
      ret   << "  <tbody>"
      (arr || []).each_with_index do |(key, val), i|
        klass = i % 2 == 0 ? "even" : "odd"
        ret << "    <tr class=\"#{klass}\"><td>#{key}</td><td>#{val.inspect}</td></tr>"
      end
      if arr.blank?
        ret << "    <tr class='odd'><td colspan='2'>None</td></tr>"
      end
      ret   << "  </tbody>"
      ret   << "</table>"
      ret.join("\n")
    end

render_source(filename, line) click to toggle source

:api: private

    # File lib/merb-core/dispatch/default_exception/default_exception.rb, line 77
    def render_source(filename, line)
      line = line.to_i
      ret   =  []
      ret   << "<tr class='source'>"
      ret   << "  <td class='collapse'></td>"
      str   =  "  <td class='code' colspan='2'><div>"

      __caller_lines__(filename, line, 5) do |lline, lcode|
        str << textmate_url(filename, lline)
        str << "<em>" if line == lline
        str << Erubis::XmlHelper.escape_xml(lcode)
        str << "</em>" if line == lline
        str << "\n"
      end
      str   << "</div></td>"
      ret   << str
      ret   << "</tr>"
      ret.join("\n")
    end

textmate_url(filename, line) click to toggle source

:api: private

    # File lib/merb-core/dispatch/default_exception/default_exception.rb, line 72
    def textmate_url(filename, line)
      "<a href='txmt://open?url=file://#{filename}&amp;line=#{line}'>#{line}</a>"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.