incyclist-services 1.7.73 → 1.7.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -197,7 +197,7 @@ let RidePageService = (() => {
197
197
  onMenuClose() {
198
198
  try {
199
199
  const state = this.getRideDisplay().getState();
200
- if (state === 'Finished' || this.menuProps.finished) {
200
+ if (state === 'Finished' || this.menuProps?.finished) {
201
201
  this.moveToPreviousPage();
202
202
  this.closePage();
203
203
  return;
@@ -206,7 +206,7 @@ let RidePageService = (() => {
206
206
  this.updatePageDisplay();
207
207
  }
208
208
  catch (err) {
209
- this.logError(err, 'onMenuOpen');
209
+ this.logError(err, 'onMenuClose');
210
210
  }
211
211
  }
212
212
  onPause() {
@@ -158,6 +158,8 @@ let FreeRideService = (() => {
158
158
  if (!opts?.length && from != null) {
159
159
  opts = this.addLastSegmentReverse(opts, from);
160
160
  }
161
+ if (!from)
162
+ return opts ?? [];
161
163
  opts = this.filterOptions(opts, from);
162
164
  opts = this.sortOptions(opts, from);
163
165
  return opts;
@@ -203,9 +203,17 @@ let OverpassApi = (() => {
203
203
  const promises = [];
204
204
  this.mirrors.forEach(mirror => {
205
205
  promises.push(this.post(mirror, query)
206
- .then((res) => res?.data)
206
+ .then((res) => {
207
+ if (res?.status >= 400) {
208
+ const err = Object.assign(new Error(`HTTP ${res.status}`), { response: res });
209
+ errors.push(this.extractErrorInfo(err, mirror));
210
+ throw err;
211
+ }
212
+ return res?.data;
213
+ })
207
214
  .catch(err => {
208
- errors.push(this.extractErrorInfo(err, mirror));
215
+ if (!errors.find(e => e.mirror === mirror))
216
+ errors.push(this.extractErrorInfo(err, mirror));
209
217
  throw err;
210
218
  }));
211
219
  });
@@ -237,6 +245,9 @@ let OverpassApi = (() => {
237
245
  }
238
246
  try {
239
247
  const res = await this.post(mirror, query);
248
+ if (res?.status >= 400) {
249
+ throw Object.assign(new Error(`HTTP ${res.status}`), { response: res });
250
+ }
240
251
  return res?.data;
241
252
  }
242
253
  catch (err) {
@@ -194,7 +194,7 @@ let RidePageService = (() => {
194
194
  onMenuClose() {
195
195
  try {
196
196
  const state = this.getRideDisplay().getState();
197
- if (state === 'Finished' || this.menuProps.finished) {
197
+ if (state === 'Finished' || this.menuProps?.finished) {
198
198
  this.moveToPreviousPage();
199
199
  this.closePage();
200
200
  return;
@@ -203,7 +203,7 @@ let RidePageService = (() => {
203
203
  this.updatePageDisplay();
204
204
  }
205
205
  catch (err) {
206
- this.logError(err, 'onMenuOpen');
206
+ this.logError(err, 'onMenuClose');
207
207
  }
208
208
  }
209
209
  onPause() {
@@ -152,6 +152,8 @@ let FreeRideService = (() => {
152
152
  if (!opts?.length && from != null) {
153
153
  opts = this.addLastSegmentReverse(opts, from);
154
154
  }
155
+ if (!from)
156
+ return opts ?? [];
155
157
  opts = this.filterOptions(opts, from);
156
158
  opts = this.sortOptions(opts, from);
157
159
  return opts;
@@ -197,9 +197,17 @@ let OverpassApi = (() => {
197
197
  const promises = [];
198
198
  this.mirrors.forEach(mirror => {
199
199
  promises.push(this.post(mirror, query)
200
- .then((res) => res?.data)
200
+ .then((res) => {
201
+ if (res?.status >= 400) {
202
+ const err = Object.assign(new Error(`HTTP ${res.status}`), { response: res });
203
+ errors.push(this.extractErrorInfo(err, mirror));
204
+ throw err;
205
+ }
206
+ return res?.data;
207
+ })
201
208
  .catch(err => {
202
- errors.push(this.extractErrorInfo(err, mirror));
209
+ if (!errors.find(e => e.mirror === mirror))
210
+ errors.push(this.extractErrorInfo(err, mirror));
203
211
  throw err;
204
212
  }));
205
213
  });
@@ -231,6 +239,9 @@ let OverpassApi = (() => {
231
239
  }
232
240
  try {
233
241
  const res = await this.post(mirror, query);
242
+ if (res?.status >= 400) {
243
+ throw Object.assign(new Error(`HTTP ${res.status}`), { response: res });
244
+ }
234
245
  return res?.data;
235
246
  }
236
247
  catch (err) {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "incyclist-services",
3
- "version": "1.7.73",
3
+ "version": "1.7.74",
4
4
  "peerDependencies": {
5
5
  "gd-eventlog": "^0.1.27"
6
6
  },
7
7
  "dependencies": {
8
8
  "@garmin/fitsdk": "^21.200.0",
9
9
  "axios": "^1.15.2",
10
- "incyclist-devices": "^3.0.22",
10
+ "incyclist-devices": "^3.0.23",
11
11
  "promise.any": "^2.0.6",
12
12
  "semver": "^7.7.4",
13
13
  "tcx-builder": "^1.1.1",