From 64799e69061b79f0b0ecb55e649582c9c3b0026e Mon Sep 17 00:00:00 2001 From: Sean Kelly Date: Sun, 1 Dec 2024 03:59:14 -0800 Subject: [PATCH] feat: Adjust allowed error codes for detecting node:sqlite (#3900) --- index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 77c0bfde178..4c44c678df7 100644 --- a/index.js +++ b/index.js @@ -53,9 +53,10 @@ try { const SqliteCacheStore = require('./lib/cache/sqlite-cache-store') module.exports.cacheStores.SqliteCacheStore = SqliteCacheStore } catch (err) { - if (err.code !== 'ERR_UNKNOWN_BUILTIN_MODULE') { - throw err - } + // Most likely node:sqlite was not present, since SqliteCacheStore is + // optional, don't throw. Don't check specific error codes here because while + // ERR_UNKNOWN_BUILTIN_MODULE is expected, users have seen other codes like + // MODULE_NOT_FOUND } module.exports.buildConnector = buildConnector