@tmlmobilidade/types 20260627.41.35 → 20260627.1143.10
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.
- package/dist/gtfs/stop-times.js +8 -8
- package/package.json +1 -1
package/dist/gtfs/stop-times.js
CHANGED
|
@@ -10,22 +10,22 @@ import { validateGtfsBinary, validateGtfsPickupDropoffType } from './common.js';
|
|
|
10
10
|
export function validateGtfsStopTime(rawData) {
|
|
11
11
|
// Ensure required fields are present
|
|
12
12
|
if (!rawData.arrival_time)
|
|
13
|
-
throw new Error(
|
|
13
|
+
throw new Error(`Missing required field "arrival_time" on GTFS StopTime: ${JSON.stringify(rawData)}`);
|
|
14
14
|
if (!rawData.departure_time)
|
|
15
|
-
throw new Error(
|
|
15
|
+
throw new Error(`Missing required field "departure_time" on GTFS StopTime: ${JSON.stringify(rawData)}`);
|
|
16
16
|
if (!rawData.shape_dist_traveled)
|
|
17
|
-
throw new Error(
|
|
17
|
+
throw new Error(`Missing required field "shape_dist_traveled" on GTFS StopTime: ${JSON.stringify(rawData)}`);
|
|
18
18
|
if (!rawData.stop_id)
|
|
19
|
-
throw new Error(
|
|
19
|
+
throw new Error(`Missing required field "stop_id" on GTFS StopTime: ${JSON.stringify(rawData)}`);
|
|
20
20
|
if (!rawData.stop_sequence)
|
|
21
|
-
throw new Error(
|
|
21
|
+
throw new Error(`Missing required field "stop_sequence" on GTFS StopTime: ${JSON.stringify(rawData)}`);
|
|
22
22
|
if (!rawData.trip_id)
|
|
23
|
-
throw new Error(
|
|
23
|
+
throw new Error(`Missing required field "trip_id" on GTFS StopTime: ${JSON.stringify(rawData)}`);
|
|
24
24
|
// Validate the individual fields
|
|
25
25
|
if (Number.isNaN(rawData.shape_dist_traveled))
|
|
26
|
-
throw new Error(`Invalid value for "shape_dist_traveled": "${rawData.shape_dist_traveled}". It must be a number
|
|
26
|
+
throw new Error(`Invalid value for "shape_dist_traveled": "${rawData.shape_dist_traveled}". It must be a number. GTFS StopTime: ${JSON.stringify(rawData)}`);
|
|
27
27
|
if (Number.isNaN(rawData.stop_sequence))
|
|
28
|
-
throw new Error(`Invalid value for "stop_sequence": "${rawData.stop_sequence}". It must be a number
|
|
28
|
+
throw new Error(`Invalid value for "stop_sequence": "${rawData.stop_sequence}". It must be a number. GTFS StopTime: ${JSON.stringify(rawData)}`);
|
|
29
29
|
// Transform the raw data into the output format
|
|
30
30
|
return {
|
|
31
31
|
arrival_time: rawData.arrival_time,
|