Bug 25032: Chomp stringified exception
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 14 Apr 2020 20:50:58 +0000 (17:50 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 29 Apr 2020 15:24:24 +0000 (16:24 +0100)
commit5d36a311fe7dfcd99fd4ac31abca606cc815b280
treeedc57cac75e3f0a38a2f98b12919e0afee9774b2
parentaf60dd912a1a3b732bce359b63cfd88a93217cd5
Bug 25032: Chomp stringified exception

If we catch a Koha::Exception-derived exception, the log is put in a
single line. If the code 'dies' then a newline character is appended to
the string. This patch chomps it so it displays in a single line.

To test:
1. Tweak Koha::REST::V1::Cities::list in the try block so it dies before
   render
2. Restart plack and try the original test plan
=> FAIL: Notice two lines are logged
3. Apply this patch
4. Repeat 2
=> SUCCESS: Only one line in the logs
5. Verify rendering a Koha::Exception works as well:
   Koha::Exceptions::Exception->throw("Nada!");

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/REST/Plugin/Exceptions.pm