Methods
- application_trace
- framework_trace
- full_trace
- new
- rescue_template
- source_extracts
- status_code
- status_code_for_exception
- traces
Attributes
[R] | backtrace_cleaner | |
[R] | exception | |
[R] | file | |
[R] | line_number |
Class Public methods
new(backtrace_cleaner, exception)
📝 Source code
# File actionpack/lib/action_dispatch/middleware/exception_wrapper.rb, line 34
def initialize(backtrace_cleaner, exception)
@backtrace_cleaner = backtrace_cleaner
@exception = original_exception(exception)
expand_backtrace if exception.is_a?(SyntaxError) || exception.cause.is_a?(SyntaxError)
end
🔎 See on GitHub
status_code_for_exception(class_name)
📝 Source code
# File actionpack/lib/action_dispatch/middleware/exception_wrapper.rb, line 85
def self.status_code_for_exception(class_name)
Rack::Utils.status_code(@@rescue_responses[class_name])
end
🔎 See on GitHub
Instance Public methods
application_trace()
📝 Source code
# File actionpack/lib/action_dispatch/middleware/exception_wrapper.rb, line 49
def application_trace
clean_backtrace(:silent)
end
🔎 See on GitHub
framework_trace()
📝 Source code
# File actionpack/lib/action_dispatch/middleware/exception_wrapper.rb, line 53
def framework_trace
clean_backtrace(:noise)
end
🔎 See on GitHub
full_trace()
📝 Source code
# File actionpack/lib/action_dispatch/middleware/exception_wrapper.rb, line 57
def full_trace
clean_backtrace(:all)
end
🔎 See on GitHub
rescue_template()
📝 Source code
# File actionpack/lib/action_dispatch/middleware/exception_wrapper.rb, line 41
def rescue_template
@@rescue_templates[@exception.class.name]
end
🔎 See on GitHub
source_extracts()
📝 Source code
# File actionpack/lib/action_dispatch/middleware/exception_wrapper.rb, line 89
def source_extracts
backtrace.map do |trace|
file, line_number = extract_file_and_line_number(trace)
{
code: source_fragment(file, line_number),
line_number: line_number
}
end
end
🔎 See on GitHub
status_code()
📝 Source code
# File actionpack/lib/action_dispatch/middleware/exception_wrapper.rb, line 45
def status_code
self.class.status_code_for_exception(@exception.class.name)
end
🔎 See on GitHub
traces()
📝 Source code
# File actionpack/lib/action_dispatch/middleware/exception_wrapper.rb, line 61
def traces
application_trace_with_ids = []
framework_trace_with_ids = []
full_trace_with_ids = []
full_trace.each_with_index do |trace, idx|
trace_with_id = { id: idx, trace: trace }
if application_trace.include?(trace)
application_trace_with_ids << trace_with_id
else
framework_trace_with_ids << trace_with_id
end
full_trace_with_ids << trace_with_id
end
{
"Application Trace" => application_trace_with_ids,
"Framework Trace" => framework_trace_with_ids,
"Full Trace" => full_trace_with_ids
}
end
🔎 See on GitHub