chg: Catch NoValidHarFile exceptions

pull/771/head
Raphaël Vinot 2023-08-30 12:45:06 +02:00
parent 1c516d58f3
commit 5634eaa27a
1 changed files with 7 additions and 1 deletions

View File

@ -13,7 +13,7 @@ from werkzeug.security import check_password_hash
from lacuscore import CaptureStatus as CaptureStatusCore
from pylacus import CaptureStatus as CaptureStatusPy
from lookyloo.comparator import Comparator
from lookyloo.exceptions import MissingUUID
from lookyloo.exceptions import MissingUUID, NoValidHarFile
from lookyloo.lookyloo import Lookyloo, CaptureSettings
from .helpers import build_users_table, load_user_from_request, src_request_ip
@ -37,6 +37,12 @@ token_request_fields = api.model('AuthTokenFields', {
})
@api.errorhandler(NoValidHarFile)
def handle_no_HAR_file_exception(error):
'''The capture has no HAR file, it failed for some reason.'''
return {'message': str(error)}, 400
@api.route('/json/get_token')
@api.doc(description='Get the API token required for authenticated calls')
class AuthToken(Resource):