@transportme/load-ptv-gtfs 1.4.35 → 1.4.37

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.
@@ -21,22 +21,31 @@ export default class GTFSCalendarReader extends GTFSReader {
21
21
  this.#calendarDateFile = calendarDateFile
22
22
  }
23
23
 
24
+ #checkMissingFile(e) {
25
+ if (!e.stack.includes('ENOENT')) throw e
26
+ }
27
+
24
28
  async open() {
25
29
  try {
26
30
  await super.open()
27
- } catch (e) { this.#hasCalendar = false }
31
+ } catch (e) {
32
+ this.#checkMissingFile(e)
33
+ this.#hasCalendar = false
34
+ }
28
35
 
29
36
  if (!this.#calendarDateFile) return
30
- let calendarDateReader = new GTFSCalendarDateReader(this.#calendarDateFile)
31
- await calendarDateReader.open()
32
- while (calendarDateReader.available()) {
33
- let calendarDate = await calendarDateReader.getNextEntity()
34
- if (!this.#calendarDates[calendarDate.id]) {
35
- this.#calendarDates[calendarDate.id] = []
36
- this.#unprocessedCalendarDates.add(calendarDate.id)
37
+ try {
38
+ let calendarDateReader = new GTFSCalendarDateReader(this.#calendarDateFile)
39
+ await calendarDateReader.open()
40
+ while (calendarDateReader.available()) {
41
+ let calendarDate = await calendarDateReader.getNextEntity()
42
+ if (!this.#calendarDates[calendarDate.id]) {
43
+ this.#calendarDates[calendarDate.id] = []
44
+ this.#unprocessedCalendarDates.add(calendarDate.id)
45
+ }
46
+ this.#calendarDates[calendarDate.id].push(calendarDate)
37
47
  }
38
- this.#calendarDates[calendarDate.id].push(calendarDate)
39
- }
48
+ } catch (e) { this.#checkMissingFile(e) }
40
49
  }
41
50
 
42
51
  /**
@@ -121,7 +121,7 @@ export default class RouteLoader {
121
121
  let route = await this.#routesReader.getNextEntity()
122
122
  await this.loadRoute(route, processRoute)
123
123
  } catch (e) {
124
- console.error('Failed to load trip', e)
124
+ console.error('Failed to load route', e)
125
125
  }
126
126
  }
127
127
  }
@@ -154,7 +154,7 @@ export default class StopsLoader {
154
154
  * @param {function} options.getMergeName Used to get a stop's merge name. Return null to use the default merge name.
155
155
  */
156
156
  async loadStop(stop, { processStop, getMergeName } = {}) {
157
- let processedData = processStop ? processStop(stop) : stop
157
+ let processedData = processStop ? await processStop(stop) : stop
158
158
  if (!processedData) return
159
159
 
160
160
  if (processedData.parentStopGTFSID) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transportme/load-ptv-gtfs",
3
- "version": "1.4.35",
3
+ "version": "1.4.37",
4
4
  "description": "",
5
5
  "main": "index.mjs",
6
6
  "scripts": {