
Added a exception handler for : for api endpoint action/gps_update, when trip_log is empty, returns error to client instead of just not inserting any rows.
@f5521d5783f73a1c141e6aa60635b230ab5dd6d3
--- action.py
+++ action.py
... | ... | @@ -168,6 +168,9 @@ |
168 | 168 |
data = request.get_json() |
169 | 169 |
if len(data["trip_id"]) !=64: |
170 | 170 |
return jsonify({500 :"ERROR! INVALID TRIP_ID!"}) |
171 |
+ |
|
172 |
+ if len(data["trip_log"]["timestamp"]) == 0: |
|
173 |
+ return jsonify({500 :"ERROR! 'trip_log' is empty!"}) |
|
171 | 174 |
|
172 | 175 |
df = pd.DataFrame(data["trip_log"]) |
173 | 176 |
df["user_id"] = data["user_id"] |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?