mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-28 02:26:10 +00:00
api/cookie: replace name exception with console log
much easier to debug when writing a service
This commit is contained in:
parent
fbacb94495
commit
58edad553e
|
@ -1,7 +1,7 @@
|
||||||
import Cookie from './cookie.js';
|
import Cookie from './cookie.js';
|
||||||
|
|
||||||
import { readFile, writeFile } from 'fs/promises';
|
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 { parse as parseSetCookie, splitCookiesString } from 'set-cookie-parser';
|
||||||
import * as cluster from '../../misc/cluster.js';
|
import * as cluster from '../../misc/cluster.js';
|
||||||
import { isCluster } from '../../config.js';
|
import { isCluster } from '../../config.js';
|
||||||
|
@ -103,8 +103,9 @@ export const setup = async (path) => {
|
||||||
|
|
||||||
export function getCookie(service) {
|
export function getCookie(service) {
|
||||||
if (!VALID_SERVICES.has(service)) {
|
if (!VALID_SERVICES.has(service)) {
|
||||||
throw `${service} not in allowed services list for cookies.`
|
console.error(`${Red('[!]')} ${service} not in allowed services list for cookies.`
|
||||||
+ ' if adding a new cookie type, include it there.';
|
+ ' if adding a new cookie type, include it there.');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cookies[service] || !cookies[service].length) return;
|
if (!cookies[service] || !cookies[service].length) return;
|
||||||
|
|
Loading…
Reference in a new issue