api/cookie: replace name exception with console log

much easier to debug when writing a service
This commit is contained in:
jj 2024-11-26 14:04:39 +00:00
parent fbacb94495
commit 58edad553e
No known key found for this signature in database

View file

@ -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;