aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template/error.rb
diff options
context:
space:
mode:
authorMikel Lindsaar <raasdnil@gmail.com>2010-03-28 14:44:34 +1100
committerMikel Lindsaar <raasdnil@gmail.com>2010-03-28 14:44:34 +1100
commit2bcc2ebf44b59e46c104c92d621e8051c97bfcf5 (patch)
treed2a3f04fd3020c1b5d88847af62d52f2d5e5bd61 /actionpack/lib/action_view/template/error.rb
parentf5774e3e3f70a3acfa559b9ff889e9417fb71d4b (diff)
parent8398f21880a952769ccd6437a4344922fe596dab (diff)
downloadrails-2bcc2ebf44b59e46c104c92d621e8051c97bfcf5.tar.gz
rails-2bcc2ebf44b59e46c104c92d621e8051c97bfcf5.tar.bz2
rails-2bcc2ebf44b59e46c104c92d621e8051c97bfcf5.zip
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'actionpack/lib/action_view/template/error.rb')
-rw-r--r--actionpack/lib/action_view/template/error.rb24
1 files changed, 22 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/template/error.rb b/actionpack/lib/action_view/template/error.rb
index 648f708d3d..5222ffa89c 100644
--- a/actionpack/lib/action_view/template/error.rb
+++ b/actionpack/lib/action_view/template/error.rb
@@ -1,6 +1,26 @@
require "active_support/core_ext/enumerable"
module ActionView
+ class ActionViewError < StandardError #:nodoc:
+ end
+
+ class MissingTemplate < ActionViewError #:nodoc:
+ attr_reader :path
+
+ def initialize(paths, path, details, partial)
+ @path = path
+ display_paths = paths.compact.map{ |p| p.to_s.inspect }.join(", ")
+ template_type = if partial
+ "partial"
+ elsif path =~ /layouts/i
+ 'layout'
+ else
+ 'template'
+ end
+
+ super("Missing #{template_type} #{path} with #{details.inspect} in view paths #{display_paths}")
+ end
+ end
class Template
# The Template::Error exception is raised when the compilation of the template fails. This exception then gathers a
# bunch of intimate details and uses it to report a very precise exception message.
@@ -73,11 +93,11 @@ module ActionView
end
def to_s
- "\n#{self.class} (#{message}) #{source_location}:\n" +
+ "\n#{self.class} (#{message}) #{source_location}:\n" +
"#{source_extract}\n #{clean_backtrace.join("\n ")}\n\n"
end
- # don't do anything nontrivial here. Any raised exception from here becomes fatal
+ # don't do anything nontrivial here. Any raised exception from here becomes fatal
# (and can't be rescued).
def backtrace
@backtrace