From 58edad553ed7a8dfc2fe6e24106dc71961d84f52 Mon Sep 17 00:00:00 2001 From: jj Date: Tue, 26 Nov 2024 14:04:39 +0000 Subject: [PATCH] api/cookie: replace name exception with console log much easier to debug when writing a service --- api/src/processing/cookie/manager.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/src/processing/cookie/manager.js b/api/src/processing/cookie/manager.js index fb5ca1b6..4363aec9 100644 --- a/api/src/processing/cookie/manager.js +++ b/api/src/processing/cookie/manager.js @@ -1,7 +1,7 @@ import Cookie from './cookie.js'; import { readFile, writeFile } from 'fs/promises'; -import { Green, Yellow } from '../../misc/console-text.js'; +import { Red, Green, Yellow } from '../../misc/console-text.js'; import { parse as parseSetCookie, splitCookiesString } from 'set-cookie-parser'; import * as cluster from '../../misc/cluster.js'; import { isCluster } from '../../config.js'; @@ -103,8 +103,9 @@ export const setup = async (path) => { export function getCookie(service) { if (!VALID_SERVICES.has(service)) { - throw `${service} not in allowed services list for cookies.` - + ' if adding a new cookie type, include it there.'; + console.error(`${Red('[!]')} ${service} not in allowed services list for cookies.` + + ' if adding a new cookie type, include it there.'); + return; } if (!cookies[service] || !cookies[service].length) return;