diff --git a/app/controllers/problems_controller.rb b/app/controllers/problems_controller.rb index 6e9f24d..5821a4e 100644 --- a/app/controllers/problems_controller.rb +++ b/app/controllers/problems_controller.rb @@ -61,7 +61,7 @@ class ProblemsController < ApplicationController end def create_issue - body = render_to_string "issue_trackers/issue", layout: false, formats: [:txt] + body = render_to_string "issue_trackers/issue", layout: false, formats: [:md] title = "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}" issue = Issue.new(problem: problem, user: current_user, title: title, body: body) diff --git a/app/helpers/hash_helper.rb b/app/helpers/hash_helper.rb index 75f5756..2fc80a8 100644 --- a/app/helpers/hash_helper.rb +++ b/app/helpers/hash_helper.rb @@ -1,6 +1,8 @@ module HashHelper def pretty_hash(hash, nesting = 0) + return '{}' if hash.empty? + tab_size = 2 nesting += 1 diff --git a/app/views/issue_trackers/issue.md.erb b/app/views/issue_trackers/issue.md.erb new file mode 100644 index 0000000..56353a9 --- /dev/null +++ b/app/views/issue_trackers/issue.md.erb @@ -0,0 +1,41 @@ +[See this exception on Errbit](<%= app_problem_url problem.app, problem %>) +<% if notice = problem.notices.first %> +# <%= notice.message %> # +## Summary ## +<% if notice.request['url'].present? %> +### URL ### +[<%= notice.request['url'] %>](<%= notice.request['url'] %>)" +<% end %> +### Where ### +<%= notice.where %> + +### Occured ### +<%= notice.created_at.to_s(:micro) %> + +### Similar ### +<%= (notice.problem.notices_count - 1).to_s %> + +## Params ## +~~~ +<%= pretty_hash(notice.params) %> +~~~ + +## Session ## +~~~ +<%= pretty_hash(notice.session) %> +~~~ + +## Backtrace ## +~~~ +<% notice.backtrace_lines.each do |line| %><%= line.number %>: <%= line.file_relative %> -> **<%= line.method %>** +<% end %> +~~~ + +<% if notice.env_vars.present? %> +## Environment ## +| Key | Value | +|------------|------------| +<% notice.env_vars.each do |key, val| %>| <%= key %> | <%= val %> | +<% end %> +<% end %> +<% end %> diff --git a/app/views/issue_trackers/issue.txt.erb b/app/views/issue_trackers/issue.txt.erb index 46379f0..ff285cb 100644 --- a/app/views/issue_trackers/issue.txt.erb +++ b/app/views/issue_trackers/issue.txt.erb @@ -1,45 +1,21 @@ -[See this exception on Errbit](<%= app_problem_url problem.app, problem %> "See this exception on Errbit") +Errbit link: <%= app_problem_url problem.app, problem %> <% if notice = problem.notices.first %> -# <%= notice.message %> # -## Summary ## -<% if notice.request['url'].present? %> -### URL ### -[<%= notice.request['url'] %>](<%= notice.request['url'] %>)" -<% end %> -### Where ### -<%= notice.where %> - -### Occured ### -<%= notice.created_at.to_s(:micro) %> - -### Similar ### -<%= (notice.problem.notices_count - 1).to_s %> - -## Params ## -``` -<%= pretty_hash(notice.params) %> -``` +<% notice.message %> -## Session ## -``` -<%= pretty_hash(notice.session) %> -``` - -## Backtrace ## -``` -<% notice.backtrace_lines.each do |line| %><%= line.number %>: <%= line.file_relative %> -> **<%= line.method %>** +Summary +------- +<% if notice.request['url'].present? %> +URL: <%= notice.request['url'] %> <% end %> -``` - -## Environment ## - -
<%= key %>: | -<%= val %> | -