gtfs 4.18.3 → 4.18.5

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.
@@ -91,7 +91,8 @@ async function getConfig(argv2) {
91
91
  } catch (error) {
92
92
  if (error instanceof SyntaxError) {
93
93
  throw new Error(
94
- `Cannot parse configuration file. Check to ensure that it is valid JSON. Error: ${error.message}`
94
+ `Cannot parse configuration file. Check to ensure that it is valid JSON. Error: ${error.message}`,
95
+ { cause: error }
95
96
  );
96
97
  }
97
98
  throw error;
@@ -4097,6 +4098,26 @@ var vehicles = {
4097
4098
 
4098
4099
  // src/lib/db.ts
4099
4100
  import Database from "better-sqlite3";
4101
+
4102
+ // src/lib/errors.ts
4103
+ var GtfsError = class extends Error {
4104
+ code;
4105
+ category;
4106
+ isOperational;
4107
+ statusCode;
4108
+ details;
4109
+ constructor(message, options) {
4110
+ super(message, { cause: options.cause });
4111
+ this.name = "GtfsError";
4112
+ this.code = options.code;
4113
+ this.category = options.category;
4114
+ this.isOperational = options.isOperational ?? true;
4115
+ this.statusCode = options.statusCode;
4116
+ this.details = options.details;
4117
+ }
4118
+ };
4119
+
4120
+ // src/lib/db.ts
4100
4121
  var dbs = {};
4101
4122
  function setupDb(sqlitePath) {
4102
4123
  const db = new Database(untildify(sqlitePath));
@@ -4125,11 +4146,19 @@ function openDb(config = null) {
4125
4146
  return dbs[filename];
4126
4147
  }
4127
4148
  if (Object.keys(dbs).length > 1) {
4128
- throw new Error(
4129
- "Multiple databases open, please specify which one to use."
4149
+ throw new GtfsError(
4150
+ "Multiple databases open, please specify which one to use.",
4151
+ {
4152
+ code: "GTFS_DB_OPERATION_FAILED" /* GTFS_DB_OPERATION_FAILED */,
4153
+ category: "database" /* DATABASE */,
4154
+ details: { openDatabaseCount: Object.keys(dbs).length }
4155
+ }
4130
4156
  );
4131
4157
  }
4132
- throw new Error("Unable to find database connection.");
4158
+ throw new GtfsError("Unable to find database connection.", {
4159
+ code: "GTFS_DB_OPERATION_FAILED" /* GTFS_DB_OPERATION_FAILED */,
4160
+ category: "database" /* DATABASE */
4161
+ });
4133
4162
  }
4134
4163
 
4135
4164
  // src/lib/geojson-utils.ts