solid_errors 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a034955a760c572f2e8e317e1120eed78d92a0fe1a55cae7f96e571c66ef00cd
4
- data.tar.gz: 8d7490b0198ee2e899c712c749a9e907755df31c3a900a51f21db5d089267ea7
3
+ metadata.gz: a2eee8c990cddbb820d0e26419c5a08d163552840313b5468d15c9590d07f831
4
+ data.tar.gz: 578aac9f9b1f58003b50cd1482cedbda43804e54ee1349a52fd47f79acc51f18
5
5
  SHA512:
6
- metadata.gz: 9f674d6137d43517bc2c984c49bef87b521cc8fd72001f0d7fc6c14ac9072bd5a944af1f78ee06a74f10e0793db5187015d995915fda37bf5ed6f9e4f2314ea8
7
- data.tar.gz: 39b0a00ec120b2d2a4c80b7602cacbc18ce97ad268cba8a62426d4c77c593ca7d10d7af18bb54c768530f2f7fe6999bdff76e533db74c7adc2680c2104d19f24
6
+ metadata.gz: 5ec9d232d8e0b622cfa099b2c2fd16232681b65ca24825411caa95cf91680da02099a0ddb6ce2901ce3857d9489cf2d0cef410aef8609f6cc54ff2ff19821afd
7
+ data.tar.gz: 61a0e98f22ee56313cb7867452b0ae42945a204cb5736edec59aa429d103d4b136ba223bf28bc7d54f85bb7c00b483d2557e41473c76f38fdff915577c9004a6
data/README.md CHANGED
@@ -30,22 +30,28 @@ Solid Errors is a DB-based, app-internal exception tracker for Rails application
30
30
  ## Installation
31
31
 
32
32
  Install the gem and add to the application's Gemfile by executing:
33
-
34
- $ bundle add solid_errors
33
+ ```bash
34
+ $ bundle add solid_errors
35
+ ```
35
36
 
36
37
  If bundler is not being used to manage dependencies, install the gem by executing:
37
-
38
- $ gem install solid_errors
38
+ ```bash
39
+ $ gem install solid_errors
40
+ ```
39
41
 
40
42
  After installing the gem, run the installer:
41
-
42
- $ rails generate solid_errors:install
43
+ ```bash
44
+ $ rails generate solid_errors:install
45
+ ```
43
46
 
44
47
  This will copy the required migration over to your app.
45
48
 
46
- Then mount the engine in your config/routes.rb file
47
-
48
- mount SolidErrors::Engine, at: "/solid_errors"
49
+ Then mount the engine in your `config/routes.rb` file:
50
+ ```ruby
51
+ authenticate :user, -> (user) { user.admin? } do
52
+ mount SolidErrors::Engine, at: "/solid_errors"
53
+ end
54
+ ```
49
55
 
50
56
  > [!NOTE]
51
57
  > Be sure to [secure the dashboard](#authentication) in production.
@@ -29,7 +29,7 @@ module SolidErrors
29
29
  attr_reader :file
30
30
  attr_reader :number
31
31
  attr_reader :method
32
- attr_reader :filtered_file, :filtered_number, :filtered_method
32
+ attr_reader :filtered_file, :filtered_number, :filtered_method, :unparsed_line
33
33
 
34
34
  # Parses a single line of a given backtrace
35
35
  #
@@ -47,13 +47,14 @@ module SolidErrors
47
47
 
48
48
  file, number, method = match[1], match[2], match[3]
49
49
  filtered_args = [fmatch[1], fmatch[2], fmatch[3]]
50
- new(file, number, method, *filtered_args, opts.fetch(:source_radius, 2))
50
+ new(unparsed_line, file, number, method, *filtered_args, opts.fetch(:source_radius, 2))
51
51
  end
52
52
  end
53
53
 
54
- def initialize(file, number, method, filtered_file = file,
54
+ def initialize(unparsed_line, file, number, method, filtered_file = file,
55
55
  filtered_number = number, filtered_method = method,
56
56
  source_radius = 2)
57
+ self.unparsed_line = unparsed_line
57
58
  self.filtered_file = filtered_file
58
59
  self.filtered_number = filtered_number
59
60
  self.filtered_method = filtered_method
@@ -87,7 +88,7 @@ module SolidErrors
87
88
 
88
89
  private
89
90
 
90
- attr_writer :file, :number, :method, :filtered_file, :filtered_number, :filtered_method
91
+ attr_writer :file, :number, :method, :filtered_file, :filtered_number, :filtered_method, :unparsed_line
91
92
 
92
93
  attr_accessor :source_radius
93
94
 
@@ -1093,6 +1093,13 @@
1093
1093
  <%= content_for?(:content) ? yield(:content) : yield %>
1094
1094
  </main>
1095
1095
 
1096
+ <footer class="container mx-auto py-4 mt-24 text-base flex justify-between items-center border-t">
1097
+ <p>
1098
+ <code><strong>Solid</strong> <em>Errors</em></code>&nbsp;&nbsp;|&nbsp;
1099
+ Made by <a href="https://twitter.com/fractaledmind" class="text-blue-500 hover:underline decoration-blue-500">@fractaledmind</a> and <a href="https://github.com/fractaledmind/solid_errors/graphs/contributors" class="text-blue-500 hover:underline decoration-blue-500">friends</a>! Want to help? It's <a href="https://github.com/fractaledmind/solid_errors" class="text-blue-500 hover:underline decoration-blue-500">open source</a>!
1100
+ </p>
1101
+ </footer>
1102
+
1096
1103
  <div class="fixed top-0 left-0 right-0 text-center py-2">
1097
1104
  <% if notice.present? %>
1098
1105
  <p id="notice"
@@ -27,9 +27,13 @@
27
27
  <% backtrace.lines.each_with_index do |line, i| %>
28
28
  <%= tag.details open: line.application? || i.zero? do %>
29
29
  <summary class="hover:bg-gray-50 px-2 py-1 rounded cursor-pointer">
30
- <span class="text-gray-500"><%= File.dirname(line.filtered_file) %>/</span><span class="text-blue-500 font-medium"><%= File.basename(line.filtered_file) %></span>:<span class="text-gray-900 font-medium"><%= line.filtered_number %></span>
31
- <span class="text-gray-500">in</span>
32
- <code class="text-green-500 font-medium"><%= line.filtered_method %></code>
30
+ <% if line.filtered_file %>
31
+ <span class="text-gray-500"><%= File.dirname(line.filtered_file) %>/</span><span class="text-blue-500 font-medium"><%= File.basename(line.filtered_file) %></span>:<span class="text-gray-900 font-medium"><%= line.filtered_number %></span>
32
+ <span class="text-gray-500">in</span>
33
+ <code class="text-green-500 font-medium"><%= line.filtered_method %></code>
34
+ <% else %>
35
+ <span class="text-gray-500"><%= line.unparsed_line %>
36
+ <% end %>
33
37
  </summary>
34
38
  <div><pre class="flex overflow-auto rounded-b-lg bg-slate-800 p-4 text-sm leading-normal text-white sm:rounded-t-lg"><code class="flex flex-col min-h-full min-w-content px-0"><% line.source.each do |n, code| %>
35
39
  <div class="line"><span class="mr-2 text-right select-none text-gray-600"><%= n %></span><span><%= code %></span></div>
@@ -3,9 +3,9 @@
3
3
  class CreateSolidErrorsTables < ActiveRecord::Migration<%= migration_version %>
4
4
  def change
5
5
  create_table :solid_errors do |t|
6
- t.string :exception_class, null: false
6
+ t.string :exception_class, null: false, limit: 200
7
7
  t.string :message, null: false
8
- t.string :severity, null: false
8
+ t.string :severity, null: false, limit: 25
9
9
  t.string :source
10
10
  t.datetime :resolved_at, index: true
11
11
 
@@ -80,7 +80,7 @@ module SolidErrors
80
80
  end
81
81
 
82
82
  def sanitize_string(string)
83
- string.gsub!(/#<(.*?):0x.*?>/, '#<\1>') # remove object_id
83
+ string = string.gsub(/#<(.*?):0x.*?>/, '#<\1>') # remove object_id
84
84
  return string unless string.respond_to?(:size) && string.size > MAX_STRING_SIZE
85
85
  string[0...MAX_STRING_SIZE] + TRUNCATED
86
86
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidErrors
4
- VERSION = "0.3.4"
4
+ VERSION = "0.3.5"
5
5
  end
data/lib/solid_errors.rb CHANGED
@@ -7,8 +7,8 @@ require_relative "solid_errors/engine"
7
7
 
8
8
  module SolidErrors
9
9
  mattr_accessor :connects_to
10
- mattr_accessor :username
11
- mattr_accessor :password
10
+ mattr_writer :username
11
+ mattr_writer :password
12
12
 
13
13
  class << self
14
14
  # use method instead of attr_accessor to ensure
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Margheim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-29 00:00:00.000000000 Z
11
+ date: 2024-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -55,6 +55,7 @@ files:
55
55
  - app/models/solid_errors/occurrence.rb
56
56
  - app/models/solid_errors/record.rb
57
57
  - app/views/layouts/solid_errors/application.html.erb
58
+ - app/views/solid_errors/error_mailer/error_occurred.text.erb
58
59
  - app/views/solid_errors/errors/_actions.html.erb
59
60
  - app/views/solid_errors/errors/_error.html.erb
60
61
  - app/views/solid_errors/errors/index.html.erb