Skip to content

Commit 59902fa

Browse files
authored
Readme (#74)
1 parent d4562f5 commit 59902fa

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

README.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</p>
2525

2626
<p align="center">
27-
Following explains how it works
27+
Following explains how it works.
2828
<br/>If you need further support, please feel free to email <a href="mailto:rpeck@frontlineutilities.co.uk">rpeck@frontlineutilities.co.uk</a>...
2929
</p>
3030

@@ -311,11 +311,17 @@ Whilst simple, it's not recommended for extended use. Very good for testing new
311311
<h5>💾 DB</h5>
312312
</div>
313313

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.
315319

316320
Ths is done automatically with the latest version of `ExceptionHandler`.
317321

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.
319325

320326
```
321327
# config/application.rb
@@ -333,7 +339,7 @@ In order for this to work, your db needs the correct table.
333339
<h5>✉️ Email</h5>
334340
</div>
335341

336-
`ExceptionHandler` also sends email notifications.
342+
`ExceptionHandler` also sends **email notifications**.
337343

338344
If you want to receive emails whenever your application raises an error, you can do so by adding your email to the config:
339345

@@ -344,15 +350,22 @@ If you want to receive emails whenever your application raises an error, you can
344350

345351
> **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.
346352
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:
348354

349355
# config/application.rb
350356
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
351363
exceptions: {
352364
:all => { notification: true },
353365
:50x => { notification: false },
354366
500 => { notification: false }
355367
}
368+
356369
}
357370

358371
---
@@ -368,17 +381,19 @@ What *most* people want out of the view is to change the way it ***looks***. Thi
368381

369382
[[ image ]]
370383

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)).
372385

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.
374387

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.
376389

377-
If you wish to change the "layout" / "look", there are **two** options...
390+
--
378391

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:
380393

381-
* Secondly,
394+
<p align="center">
395+
<img src="./readme/routes.jpg" />
396+
</p>
382397

383398
---
384399

@@ -402,14 +417,14 @@ By default, the English name of the error is used (`"404"` will appear as `"Not
402417
unauthorized: "You need to login to continue"
403418
internal_server_error: "This is a test to show the %{status} of the error"
404419

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...
406421

407422
- `%{message}` is the error's actual message ("XYZ file could not be shown")
408423
- `%{status}` is the error's status code ("Internal Server Error")
409424

410425
--
411426

412-
By default, the provided translation file is as follows:
427+
By default, only `internal_server_error` is customized by the gem:
413428

414429
# config/locales/en.yml
415430
en:

readme/routes.jpg

406 KB
Loading

0 commit comments

Comments
 (0)