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