From e5ac39cb6c12410dea7fb9c8a7aa44f4d5108f48 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 5 Jul 2022 16:27:39 -0400 Subject: [PATCH] *add error checking for pocket settings --- src/rpc.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/rpc.ts b/src/rpc.ts index cb62424..9395a9f 100644 --- a/src/rpc.ts +++ b/src/rpc.ts @@ -14,6 +14,7 @@ import { JSONRPCResponseWithResult, } from "jayson"; import config, { updateUsePocketGateway, usePocketGateway } from "./config.js"; +import { errorExit } from "./util"; const require = createRequire(import.meta.url); @@ -210,6 +211,14 @@ export async function processRpcRequest( export async function start() { if (!config.str("pocket-app-id") || !config.str("pocket-app-key")) { + const pocketHost = config.str("pocket-host"); + const pocketPort = config.uint("pocket-port"); + if (!pocketHost || !pocketPort) { + errorExit( + "Please set pocket-host and pocket-port config options if you do not have an API key set" + ); + } + const dispatchURL = new URL( `http://${config.str("pocket-host")}:${config.uint("pocket-port")}` );