You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-13Lines changed: 28 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@
24
24
</p>
25
25
26
26
<palign="center">
27
-
Following explains how it works
27
+
Following explains how it works.
28
28
<br/>If you need further support, please feel free to email <ahref="mailto:rpeck@frontlineutilities.co.uk">rpeck@frontlineutilities.co.uk</a>...
29
29
</p>
30
30
@@ -311,11 +311,17 @@ Whilst simple, it's not recommended for extended use. Very good for testing new
311
311
<h5>💾 DB</h5>
312
312
</div>
313
313
314
-
If you want to save exceptions to your database, you will need to migrate a new table.
314
+
To save exceptions to your database, you're able to set the `db` option...
315
+
316
+
[[ image ]]
317
+
318
+
Because we use a `controller` to manage the underlying way the system works, we're able to invoke the likes of a [`model`](https://github.com/richpeck/exception_handler/blob/master/app/models/exception_handler/exception.rb) with other functionality.
315
319
316
320
Ths is done automatically with the latest version of `ExceptionHandler`.
317
321
318
-
To do this, once you've enabled the option, run `rails db:migrate` from your console. Our new [`migration system`](https://github.com/richpeck/exception_handler/tree/readme#migrations) will automatically run the migration.
322
+
To do this, once you've populated the option with either `true` or a `string`, run `rails db:migrate` from your console.
323
+
324
+
Our new [`migration system`](https://github.com/richpeck/exception_handler/tree/readme#migrations) will automatically run the migration.
319
325
320
326
```
321
327
# config/application.rb
@@ -333,7 +339,7 @@ In order for this to work, your db needs the correct table.
333
339
<h5>✉️ Email</h5>
334
340
</div>
335
341
336
-
`ExceptionHandler` also sends email notifications.
342
+
`ExceptionHandler` also sends **email notifications**.
337
343
338
344
If you want to receive emails whenever your application raises an error, you can do so by adding your email to the config:
339
345
@@ -344,15 +350,22 @@ If you want to receive emails whenever your application raises an error, you can
344
350
345
351
> **Please Note** this requires [`ActionMailer`](http://guides.rubyonrails.org/action_mailer_basics.html). If you don't have any outbound SMTP server, [`SendGrid`](http://sendgrid.com) is free.
346
352
347
-
From version `0.8.0.0`, you're able to define whether email notifications are sent on a per-error basis:
353
+
From version [`0.8.0.0`](https://github.com/richpeck/exception_handler/releases/tag/v0.8.0.0), you're able to define whether email notifications are sent on a per-error basis:
348
354
349
355
# config/application.rb
350
356
config.exception_handlder = {
357
+
358
+
# This has to be present for any "notification" declarations to work
359
+
# Defaults to 'false'
360
+
email: "test@test.com",
361
+
362
+
# Each status code in the new "exceptions" block allows us to define whether email notifications are sent
351
363
exceptions: {
352
364
:all => { notification: true },
353
365
:50x => { notification: false },
354
366
500 => { notification: false }
355
367
}
368
+
356
369
}
357
370
358
371
---
@@ -368,17 +381,19 @@ What *most* people want out of the view is to change the way it ***looks***. Thi
368
381
369
382
[[ image ]]
370
383
371
-
To better explain, if [`ExceptionsController`](https://github.com/richpeck/exception_handler/blob/0.8/app/controllers/exception_handler/exceptions_controller.rb) is invoked (by `exceptions_app`), it has **ONE** method ([`show`](https://github.com/richpeck/exception_handler/blob/0.8/app/controllers/exception_handler/exceptions_controller.rb#L42)). This method calls the [`show` view](https://github.com/richpeck/exception_handler/blob/0.8/app/views/exception_handler/exceptions/show.html.erb), which is *entirely* dependent on the locales for content & the layout for the look.
384
+
To better explain, if [`ExceptionsController`](https://github.com/richpeck/exception_handler/blob/master/app/controllers/exception_handler/exceptions_controller.rb) is invoked (by `exceptions_app`), it has **ONE** method ([`show`](https://github.com/richpeck/exception_handler/blob/master/app/controllers/exception_handler/exceptions_controller.rb#L42)).
372
385
373
-
This means that if you wish to change how the view "looks" - you're *either* going to want to change your *layouts* or the [*locales*](#locales). There is NO reason to change the `show` view itself - it's succinct and entirely modular. Whilst you're definitely at liberty to change it, you'll just be making the issue more complicated than it needs to be.
386
+
This method calls the [`show` view](https://github.com/richpeck/exception_handler/blob/master/app/views/exception_handler/exceptions/show.html.erb), which is *entirely* dependent on the locales for content & the layout for the look.
374
387
375
-
-
388
+
This means that if you wish to change how the view "looks" - you're *either* going to want to change your [layout][layouts] or the [*locales*](#locales). There is NO reason to change the `show` view itself - it's succinct and entirely modular. Whilst you're definitely at liberty to change it, you'll just be making the issue more complicated than it needs to be.
376
389
377
-
If you wish to change the "layout" / "look", there are **two** options...
390
+
--
378
391
379
-
* Firstly, you can create your own layout. This is done by changing the
392
+
We've also included a number of routes which shows in [`dev`](dev) mode:
380
393
381
-
* Secondly,
394
+
<palign="center">
395
+
<imgsrc="./readme/routes.jpg" />
396
+
</p>
382
397
383
398
---
384
399
@@ -402,14 +417,14 @@ By default, the English name of the error is used (`"404"` will appear as `"Not
402
417
unauthorized: "You need to login to continue"
403
418
internal_server_error: "This is a test to show the %{status} of the error"
404
419
405
-
You get access to [`%{message}` and `%{status}`](https://github.com/richpeck/exception_handler/blob/Readme/app/views/exception_handler/exceptions/show.html.erb#L1), both inferring from an [`@exception`](https://github.com/richpeck/exception_handler/blob/master/app/controllers/exception_handler/exceptions_controller.rb#L20) object we invoke in the controller...
420
+
You get access to [`%{message}` and `%{status}`](https://github.com/richpeck/exception_handler/blob/master/app/views/exception_handler/exceptions/show.html.erb#L1), both inferring from an [`@exception`](https://github.com/richpeck/exception_handler/blob/master/app/controllers/exception_handler/exceptions_controller.rb#L20) object we invoke in the controller...
406
421
407
422
-`%{message}` is the error's actual message ("XYZ file could not be shown")
408
423
-`%{status}` is the error's status code ("Internal Server Error")
409
424
410
425
--
411
426
412
-
By default, the provided translation file is as follows:
427
+
By default, only `internal_server_error` is customized by the gem:
0 commit comments