diff --git a/rero_ils/modules/items/api_views.py b/rero_ils/modules/items/api_views.py index 43966370ef..dca07b43c6 100644 --- a/rero_ils/modules/items/api_views.py +++ b/rero_ils/modules/items/api_views.py @@ -21,7 +21,7 @@ from functools import wraps -from flask import Blueprint, abort, jsonify +from flask import Blueprint, abort, current_app, jsonify from flask import request as flask_request from flask_login import current_user from invenio_circulation.api import get_loan_for_item @@ -65,6 +65,7 @@ def decorated_view(*args, **kwargs): raise(e) except Exception as e: # raise(e) + current_app.logger.error(str(e)) return jsonify({'status': 'error: {error}'.format(error=e)}), 500 return decorated_view @@ -100,6 +101,7 @@ def decorated_view(*args, **kwargs): raise(e) except Exception as e: # raise(e) + current_app.logger.error(str(e)) return jsonify({'status': 'error: {error}'.format(error=e)}), 500 return decorated_view diff --git a/ui/src/app/circulation/main-checkin-checkout/main-checkin-checkout.component.ts b/ui/src/app/circulation/main-checkin-checkout/main-checkin-checkout.component.ts index 99b18556df..8d73e7ed87 100644 --- a/ui/src/app/circulation/main-checkin-checkout/main-checkin-checkout.component.ts +++ b/ui/src/app/circulation/main-checkin-checkout/main-checkin-checkout.component.ts @@ -294,10 +294,16 @@ export class MainCheckinCheckoutComponent implements OnInit, NoPendingChange { return item; }).filter(item => item.status === ItemStatus.ON_LOAN); }, - (err) => this.toastService.error( - _('an error occurs on the server: ') + err, - _('checkin') - ) + (err) => { + let errorMessage = ''; + if (err && err.error && err.error.status) { + errorMessage = err.error.status; + } + this.toastService.error( + _('an error occurs on the server: ') + errorMessage, + _('checkin') + ); + } ); }