Skip to content

Commit

Permalink
update error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Mar 5, 2022
1 parent d644fcf commit fc3be0c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packetraven/predicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,11 @@ def get(self) -> Dict[str, Any]:
else:
raise PredictionError(response['error']['description'])
else:
raise ConnectionError(f'connection raised error {response.status_code}')
try:
error = response.json()['error']['description']
except:
error = ''
raise ConnectionError(f'connection raised error {response.status_code} for {response.url} - {error}')

@property
def predict(self) -> PredictedTrajectory:
Expand Down Expand Up @@ -471,7 +475,7 @@ def get_predictions(
if float_altitude is not None and not packet_track.falling:
packets_at_float_altitude = packet_track[
numpy.abs(float_altitude - packet_track.altitudes) < float_altitude_uncertainty
]
]
if (
len(packets_at_float_altitude) > 0
and packets_at_float_altitude[-1].time == packet_track.times[-1]
Expand All @@ -481,7 +485,7 @@ def get_predictions(
elif packet_track.ascent_rates[-1] >= 0:
prediction_float_start_time = prediction_start_time + timedelta(
seconds=(float_altitude - prediction_start_location[2])
/ prediction_ascent_rate
/ prediction_ascent_rate
)
descent_only = False
else:
Expand Down

0 comments on commit fc3be0c

Please sign in to comment.