Added error handling on ovm response

This commit is contained in:
Computerboer
2024-01-07 00:23:18 +01:00
parent 50024cf1ca
commit bbd20f7915
5 changed files with 52 additions and 31 deletions

7
app.py
View File

@@ -1,3 +1,4 @@
from utils.helperutils import log
from traceback import print_exc
from flask import Flask, jsonify
from flask_cors import CORS, cross_origin
@@ -19,16 +20,16 @@ def gethome():
def getAllAuctions(countrycode):
try:
if countrycode not in ['NL', 'BE', 'DE']:
print('country not available: ' + countrycode)
log('country not available: ' + countrycode)
return jsonify('NOT AVAILABLE COUNTRY')
log('incoming api request')
res = getAuctionlocations(countrycode)
#return json.dumps(res, sort_keys=True, default=str)
return JsonEncoder().encode(res)
except Exception as e:
print('something went wrong ')
log('something went wrong ')
print_exc(e)
return 'internal server error', 500