gtfs 4.15.3 → 4.15.4

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.
@@ -3905,13 +3905,10 @@ async function importGtfs(initialConfig) {
3905
3905
  timer.start();
3906
3906
  const config = setDefaultConfig(initialConfig);
3907
3907
  validateConfigForImport(config);
3908
- const log2 = log(config);
3909
- const logError2 = logError(config);
3910
- const logWarning2 = logWarning(config);
3911
3908
  try {
3912
3909
  const db = openDb(config);
3913
3910
  const agencyCount = config.agencies.length;
3914
- log2(
3911
+ log(config)(
3915
3912
  `Starting GTFS import for ${pluralize2("file", agencyCount, true)} using SQLite database at ${config.sqlitePath}`
3916
3913
  );
3917
3914
  createGtfsTables(db);
@@ -3935,9 +3932,9 @@ async function importGtfs(initialConfig) {
3935
3932
  sqlitePath: config.sqlitePath,
3936
3933
  prefix: agency2.prefix,
3937
3934
  currentTimestamp: Math.floor(Date.now() / 1e3),
3938
- log: log2,
3939
- logWarning: logWarning2,
3940
- logError: logError2
3935
+ log: log(config),
3936
+ logWarning: logWarning(config),
3937
+ logError: logError(config)
3941
3938
  };
3942
3939
  if (task.url) {
3943
3940
  await downloadGtfsFiles(task);
@@ -3947,36 +3944,30 @@ async function importGtfs(initialConfig) {
3947
3944
  await updateGtfsRealtimeData(task);
3948
3945
  await rm2(tempPath, { recursive: true });
3949
3946
  } catch (error) {
3950
- handleImportError(error, config, logError2);
3947
+ if (config.ignoreErrors) {
3948
+ logError(config)(error.message);
3949
+ } else {
3950
+ throw error;
3951
+ }
3951
3952
  }
3952
3953
  });
3953
- log2(`Creating DB indexes`);
3954
+ log(config)(`Creating DB indexes`);
3954
3955
  createGtfsIndexes(db);
3955
3956
  const seconds = Math.round(timer.time() / 1e3);
3956
3957
  timer.stop();
3957
- log2(
3958
+ log(config)(
3958
3959
  `Completed GTFS import for ${pluralize2("agency", agencyCount, true)} in ${seconds} seconds
3959
3960
  `
3960
3961
  );
3961
3962
  } catch (error) {
3962
- handleDatabaseError(error, config, logError2);
3963
- }
3964
- }
3965
- function handleImportError(error, config, logError2) {
3966
- if (config.ignoreErrors) {
3967
- logError2(error.message);
3968
- } else {
3963
+ if (error?.code === "SQLITE_CANTOPEN") {
3964
+ logError(config)(
3965
+ `Unable to open sqlite database "${config.sqlitePath}" defined as \`sqlitePath\` config.json. Ensure the parent directory exists or remove \`sqlitePath\` from config.json.`
3966
+ );
3967
+ }
3969
3968
  throw error;
3970
3969
  }
3971
3970
  }
3972
- function handleDatabaseError(error, config, logError2) {
3973
- if (error?.code === "SQLITE_CANTOPEN") {
3974
- logError2(
3975
- `Unable to open sqlite database "${config.sqlitePath}" defined as \`sqlitePath\` config.json. Ensure the parent directory exists or remove \`sqlitePath\` from config.json.`
3976
- );
3977
- }
3978
- throw error;
3979
- }
3980
3971
 
3981
3972
  // src/lib/export.ts
3982
3973
  import { without, compact as compact2 } from "lodash-es";