feat: cli fix

This commit is contained in:
Nevo David
2026-05-10 21:25:19 +07:00
parent c6bd4a677c
commit 1ba8fd4d48
+14 -1
View File
@@ -289,7 +289,13 @@ async function handleDeviceToken(req: IncomingMessage, res: ServerResponse) {
// --- Server ---
const server = createServer(async (req, res) => {
const url = new URL(req.url || '/', SERVER_URL);
let url: URL;
try {
url = new URL(req.url || '/', SERVER_URL);
} catch {
json(res, 400, { error: 'invalid_url' });
return;
}
const method = req.method?.toUpperCase();
try {
@@ -334,6 +340,13 @@ async function start() {
});
}
process.on('uncaughtException', (err) => {
console.error('Uncaught exception:', err);
});
process.on('unhandledRejection', (err) => {
console.error('Unhandled rejection:', err);
});
start().catch((err) => {
console.error('Failed to start:', err);
process.exit(1);