Bug 34587: Improve SUSHI COUNTER error handling
authorPedro Amorim <pedro.amorim@ptfs-europe.com>
Mon, 23 Oct 2023 12:36:15 +0000 (12:36 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 31 Oct 2023 19:46:25 +0000 (16:46 -0300)
commitd55ea648ac6fbc87cf9d4afa7217d01915de3b55
tree5cd37f0bbe13d9fd14e3aabcdcf98bafa2f67bd5
parente629e37bd7105977ccb229796d0a1a57ca503e23
Bug 34587: Improve SUSHI COUNTER error handling

This is doing a few things, checking for sushi errors:
1) Abort background job and provide error message if SUSHI returned
   {Severity} in response, this means SUSHI error, docs here:
https://app.swaggerhub.com/apis/COUNTER/counter-sushi_5_0_api/5.0.2#/SUSHI_error_model

2) Abort background job and provide error message if SUSHI provided
   proper response, but contains Exceptions in Report_Header

3) Abort background job and provide error message if SUSHI returned 0
   report items (e.g. everything is fine but there are no items for the
   harvest period provided

4) Abort background job and provide error message if COUNTER file
   created is larger than allowed by the database.

5) Provide error message if manual upload file size exceeds the max
   allowed by the database

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/BackgroundJob/ErmSushiHarvester.pm
Koha/ERM/EUsage/UsageDataProvider.pm
Koha/REST/V1/ERM/EUsage/UsageDataProviders.pm
api/v1/swagger/paths/erm_usage_data_providers.yaml
koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/erm_sushi_harvester.inc