solid_errors 0.9.0 → 0.9.1

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: 389a4c6c9c7910c471dfc93caf7003790e1afa6c0a6781f010d6453b99731ec2
4
- data.tar.gz: 0ad0508538e6ff2f523a865e4230ff371400a56b8e897b6078c47570dd71eccc
3
+ metadata.gz: 1d793218b26cf26f6f6d6a4a87f8e14088cf555739d5ea007894a75cef13646a
4
+ data.tar.gz: a4bfc87e5a230db9ba392991ac37624ea58e5027a487260e9c3982eb13b4ef8c
5
5
  SHA512:
6
- metadata.gz: c91d2c051098cd1f3530592f76f85b9dffe8aa264f693950673f1ac8110a09f1c0b6afa86ec7eb3b071d52825899cf71cf17e75ad01f394639446df4fbf21fbd
7
- data.tar.gz: 7947a0212c04437d205c822da7a0a96fccba64907d5ad3a062afe6919934767d4d533da0f977e6d48218b7c7f6bd9d992a10cf5d157c2a661154edb0921488bc
6
+ metadata.gz: 230583bf528c6765a6205fcfbb1981d935fb866c28126fec475800dc0a11aab1e1a0aaad4a03f631e5b58a166d3d4a805f288b0b4e270ae95a949b0dd4bca7dc
7
+ data.tar.gz: 903a70c2663cf40335e5697ee882728e8aeb56e34519be322fa78be3a3505a2255f16eb78552ad0d7ba2d5bd6602ff8204beeaf63041a0b1b5c65bbf998d32aa
data/README.md CHANGED
@@ -157,14 +157,21 @@ end
157
157
 
158
158
  ### What each occurrence records
159
159
 
160
- Every occurrence stores the backtrace and the error's context. Rails adds the current request or job to that context, and Solid Errors records it as:
160
+ Every occurrence stores the backtrace and the error's context. Rails adds the current request or job to that context, and Solid Errors records which one it was: the controller action (`UsersController#show`), or the job's class, id and queue.
161
161
 
162
- * **Requests:** the controller action (`UsersController#show`) and its params, with your `config.filter_parameters` applied.
163
- * **Background jobs:** the job class, its id and queue, and its arguments, also filtered.
162
+ Request params and job arguments are not recorded unless you opt in, because they often carry user content that `config.filter_parameters` can't catch: it matches keys, so positional job arguments, mail delivery jobs (the mail's recipients and body) and webhook payloads would be stored and emailed as they are.
163
+
164
+ ```ruby
165
+ config.solid_errors.record_params = true # the request's params, with filter_parameters applied
166
+ config.solid_errors.record_arguments = true # the job's arguments, with filter_parameters applied
167
+ ```
168
+
169
+ Context you set yourself takes precedence. For example, `Rails.error.set_context(params: ...)` in a `before_action` replaces the recorded params.
164
170
 
165
171
  Any Active Record object in the context is stored as its [GlobalID](https://github.com/rails/globalid) (`gid://my-app/User/1`), so you can tell which record was involved. Add your own context with `Rails.error.set_context(...)` or the `context:` option shown above.
166
172
 
167
173
  Errors raised in background jobs reach Solid Errors when your job backend runs jobs inside the Rails executor, as Solid Queue, Sidekiq and GoodJob do. You don't need any extra setup for this.
174
+
168
175
  ### Configuration
169
176
 
170
177
  You can configure Solid Errors via the Rails configuration object, under the `solid_errors` key. Currently, the following configuration options are available:
@@ -181,6 +188,7 @@ You can configure Solid Errors via the Rails configuration object, under the `so
181
188
  * `email_subject` - A proc that builds the subject line for email notifications. See [Email notifications](#email-notifications) for more information.
182
189
  * `base_controller_class` - Specify a different controller as the base class for the Solid Errors controller. See [Authentication](#authentication) for more information.
183
190
  * `destroy_after` - If set, Solid Errors will periodically destroy resolved records that are older than the value specified. See [Automatically destroying old records](#automatically-destroying-old-records) for more information.
191
+ * `record_params` / `record_arguments` - Whether to record request params and job arguments with each occurrence. Both default to `false`. See [What each occurrence records](#what-each-occurrence-records).
184
192
  * `ignored_errors` - Error classes, or their names, to never record, in addition to the built-in list in `SolidErrors::Subscriber::IGNORED_ERRORS`. For example, `config.solid_errors.ignored_errors = ["ActiveStorage::FileNotFoundError"]`.
185
193
 
186
194
  ### Database Configuration
@@ -1190,4 +1190,189 @@
1190
1190
  padding-right: 0.75rem
1191
1191
  }
1192
1192
  }
1193
+
1194
+ /*
1195
+ Dark mode follows the operating system. Rather than adding `dark:` variants to
1196
+ the markup, it remaps the light utilities above to their dark counterparts, so
1197
+ the views and the classes the backtrace toggle swaps stay the same.
1198
+ */
1199
+
1200
+ :root{
1201
+ color-scheme: light dark
1202
+ }
1203
+
1204
+ @media (prefers-color-scheme: dark){
1205
+ *, ::before, ::after{
1206
+ border-color: #374151
1207
+ }
1208
+
1209
+ body{
1210
+ background-color: rgb(17 24 39);
1211
+ color: rgb(229 231 235)
1212
+ }
1213
+
1214
+ .divide-gray-300 > :not([hidden]) ~ :not([hidden]){
1215
+ --tw-divide-opacity: 1;
1216
+ border-color: rgb(55 65 81 / var(--tw-divide-opacity))
1217
+ }
1218
+
1219
+ .border-black{
1220
+ --tw-border-opacity: 1;
1221
+ border-color: rgb(209 213 219 / var(--tw-border-opacity))
1222
+ }
1223
+
1224
+ .border-blue-500{
1225
+ --tw-border-opacity: 1;
1226
+ border-color: rgb(96 165 250 / var(--tw-border-opacity))
1227
+ }
1228
+
1229
+ .border-gray-300{
1230
+ --tw-border-opacity: 1;
1231
+ border-color: rgb(75 85 99 / var(--tw-border-opacity))
1232
+ }
1233
+
1234
+ .border-red-500{
1235
+ --tw-border-opacity: 1;
1236
+ border-color: rgb(248 113 113 / var(--tw-border-opacity))
1237
+ }
1238
+
1239
+ .bg-gray-100{
1240
+ --tw-bg-opacity: 1;
1241
+ background-color: rgb(31 41 55 / var(--tw-bg-opacity))
1242
+ }
1243
+
1244
+ .bg-green-50{
1245
+ --tw-bg-opacity: 1;
1246
+ background-color: rgb(5 46 22 / var(--tw-bg-opacity))
1247
+ }
1248
+
1249
+ .bg-red-50{
1250
+ --tw-bg-opacity: 1;
1251
+ background-color: rgb(69 10 10 / var(--tw-bg-opacity))
1252
+ }
1253
+
1254
+ .bg-white{
1255
+ --tw-bg-opacity: 1;
1256
+ background-color: rgb(17 24 39 / var(--tw-bg-opacity))
1257
+ }
1258
+
1259
+ .text-black{
1260
+ --tw-text-opacity: 1;
1261
+ color: rgb(243 244 246 / var(--tw-text-opacity))
1262
+ }
1263
+
1264
+ .bg-blue-100{
1265
+ background-color: rgb(30 58 138 / 0.5)
1266
+ }
1267
+
1268
+ .bg-red-100{
1269
+ background-color: rgb(127 29 29 / 0.5)
1270
+ }
1271
+
1272
+ .bg-yellow-100{
1273
+ background-color: rgb(113 63 18 / 0.5)
1274
+ }
1275
+
1276
+ .bg-green-100{
1277
+ background-color: rgb(20 83 45 / 0.5)
1278
+ }
1279
+
1280
+ .bg-violet-100{
1281
+ background-color: rgb(76 29 149 / 0.5)
1282
+ }
1283
+
1284
+ .text-blue-500{
1285
+ --tw-text-opacity: 1;
1286
+ color: rgb(96 165 250 / var(--tw-text-opacity))
1287
+ }
1288
+
1289
+ .text-gray-500{
1290
+ --tw-text-opacity: 1;
1291
+ color: rgb(156 163 175 / var(--tw-text-opacity))
1292
+ }
1293
+
1294
+ .text-gray-900{
1295
+ --tw-text-opacity: 1;
1296
+ color: rgb(243 244 246 / var(--tw-text-opacity))
1297
+ }
1298
+
1299
+ .text-green-500{
1300
+ --tw-text-opacity: 1;
1301
+ color: rgb(74 222 128 / var(--tw-text-opacity))
1302
+ }
1303
+
1304
+ .text-red-500{
1305
+ --tw-text-opacity: 1;
1306
+ color: rgb(248 113 113 / var(--tw-text-opacity))
1307
+ }
1308
+
1309
+ .text-blue-800{
1310
+ --tw-text-opacity: 1;
1311
+ color: rgb(191 219 254 / var(--tw-text-opacity))
1312
+ }
1313
+
1314
+ .text-red-800{
1315
+ --tw-text-opacity: 1;
1316
+ color: rgb(254 202 202 / var(--tw-text-opacity))
1317
+ }
1318
+
1319
+ .text-yellow-800{
1320
+ --tw-text-opacity: 1;
1321
+ color: rgb(254 240 138 / var(--tw-text-opacity))
1322
+ }
1323
+
1324
+ .text-green-800{
1325
+ --tw-text-opacity: 1;
1326
+ color: rgb(187 247 208 / var(--tw-text-opacity))
1327
+ }
1328
+
1329
+ .text-violet-800{
1330
+ --tw-text-opacity: 1;
1331
+ color: rgb(221 214 254 / var(--tw-text-opacity))
1332
+ }
1333
+
1334
+ .even\:bg-gray-50:nth-child(even){
1335
+ background-color: rgb(31 41 55 / 0.5)
1336
+ }
1337
+
1338
+ .hover\:bg-gray-50:hover{
1339
+ --tw-bg-opacity: 1;
1340
+ background-color: rgb(31 41 55 / var(--tw-bg-opacity))
1341
+ }
1342
+
1343
+ .hover\:ring-blue-200:hover{
1344
+ --tw-ring-opacity: 1;
1345
+ --tw-ring-color: rgb(30 58 138 / var(--tw-ring-opacity))
1346
+ }
1347
+
1348
+ .hover\:ring-gray-200:hover{
1349
+ --tw-ring-opacity: 1;
1350
+ --tw-ring-color: rgb(55 65 81 / var(--tw-ring-opacity))
1351
+ }
1352
+
1353
+ .hover\:ring-red-200:hover{
1354
+ --tw-ring-opacity: 1;
1355
+ --tw-ring-color: rgb(127 29 29 / var(--tw-ring-opacity))
1356
+ }
1357
+
1358
+ .hover\:bg-black:hover{
1359
+ --tw-bg-opacity: 1;
1360
+ background-color: rgb(243 244 246 / var(--tw-bg-opacity))
1361
+ }
1362
+
1363
+ .hover\:text-white:hover{
1364
+ --tw-text-opacity: 1;
1365
+ color: rgb(17 24 39 / var(--tw-text-opacity))
1366
+ }
1367
+
1368
+ .hover\:text-gray-700:hover{
1369
+ --tw-text-opacity: 1;
1370
+ color: rgb(229 231 235 / var(--tw-text-opacity))
1371
+ }
1372
+
1373
+ .hover\:border-gray-300:hover{
1374
+ --tw-border-opacity: 1;
1375
+ border-color: rgb(107 114 128 / var(--tw-border-opacity))
1376
+ }
1377
+ }
1193
1378
  </style>
@@ -10,7 +10,7 @@
10
10
  <p class="text-right">
11
11
  <% page_count = page.count %>
12
12
  <% if page_count.zero? %>
13
- No posts found
13
+ No occurrences found
14
14
  <% elsif page.pages == 1 %>
15
15
  <strong><%= page_count %></strong> total
16
16
  <% else %>
@@ -53,7 +53,9 @@
53
53
  collection: occurrences, as: :occurrence %>
54
54
  <% else %>
55
55
  <div class="flex items-center justify-center gap-2">
56
- <%= bootstrap_svg "list-ul" %>
56
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-list-ul" viewBox="0 0 16 16">
57
+ <path fill-rule="evenodd" d="M5 11.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m-3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2m0 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2m0 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2"/>
58
+ </svg>
57
59
  <span class="text-2xl">No occurrences yet&hellip;</span>
58
60
  </div>
59
61
  <% end %>
@@ -52,13 +52,13 @@ module SolidErrors
52
52
  context = context.dup
53
53
  if defined?(ActionController::Metal) && (controller = context[:controller]).is_a?(ActionController::Metal)
54
54
  context[:controller] = "#{controller.class.name}##{controller.action_name}"
55
- context[:params] ||= controller.request.filtered_parameters.except("controller", "action")
55
+ context[:params] ||= controller.request.filtered_parameters.except("controller", "action") if SolidErrors.record_params
56
56
  end
57
57
  if defined?(ActiveJob::Base) && (job = context[:job]).is_a?(ActiveJob::Base)
58
58
  context[:job] = job.class.name
59
59
  context[:job_id] ||= job.job_id
60
60
  context[:queue] ||= job.queue_name
61
- context[:arguments] ||= parameter_filter.filter(arguments: s(job.arguments))[:arguments]
61
+ context[:arguments] ||= parameter_filter.filter(arguments: s(job.arguments))[:arguments] if SolidErrors.record_arguments
62
62
  end
63
63
  context
64
64
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidErrors
4
- VERSION = "0.9.0"
4
+ VERSION = "0.9.1"
5
5
  end
data/lib/solid_errors.rb CHANGED
@@ -21,6 +21,9 @@ module SolidErrors
21
21
  }
22
22
  mattr_accessor :destroy_after
23
23
  mattr_accessor :ignored_errors, default: []
24
+ # Request params and job arguments carry user content that filter_parameters' key matching misses
25
+ mattr_accessor :record_params, default: false
26
+ mattr_accessor :record_arguments, default: false
24
27
  mattr_writer :url_helper_name, :url_options
25
28
 
26
29
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Margheim