def delete(word): try: service = WordClassificationService() service.delete(word) return make_response({}, HTTPStatus.OK) # except ValueError as err: # return jsonify('Word [' + word + '] not found: ' + repr(err)), HTTPStatus.NOT_FOUND except Exception as err: return jsonify('Internal server error: ' + repr(err)), HTTPStatus.INTERNAL_SERVER_ERROR
def delete(word): response = None if request.is_json: try: service = WordClassificationService() # Execute analysis using the supplied builder entity = service.delete(word) if not entity: raise ValueError('WordClassificationService did not return a result') payload = jsonpickle.encode(entity) response = make_response(payload, HTTPStatus.NO_CONTENT) except Exception as error: print('Error: ' + repr(error)) raise else: response = make_response(HTTPStatus.BAD_REQUEST) return response