Skip to content

Commit

Permalink
type Response exception
Browse files Browse the repository at this point in the history
  • Loading branch information
mbay-ODW committed Oct 12, 2022
1 parent f424ff2 commit b8d4107
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
def health():
return '{ "status" : "UP" }'

"""# Get environment details
# Get environment details
@app.route('/environment')
def environment():
environment_data = {
Expand All @@ -48,7 +48,7 @@ def environment():
'password': os.getenv('C8Y_BOOTSTRAP_PASSWORD'),
'microserviceIsolation': os.getenv('C8Y_MICROSERVICE_ISOLATION')
}
return jsonify(environment_data)"""
return jsonify(environment_data)

if __name__ == '__main__':
logger.info("Starting")
Expand Down
7 changes: 5 additions & 2 deletions resources/measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ def post(self):
try:
payload = super().post()
print(type(payload))
statusCode,responseText = create_measurement(payload)
make_response(jsonify({"message": str(responseText)}),statusCode)
if type(payload) == 'Response':
return payload
else:
statusCode,responseText = create_measurement(payload)
make_response(jsonify({"message": str(responseText)}),statusCode)
except Exception as e:
self.logger.error(f'Received the following error: {e}. Can not proceed, returning error message and status_code 500.')
return make_response(jsonify({"message": str(e)}),500)

0 comments on commit b8d4107

Please sign in to comment.