From 4d676fc2b6f54223a58378f91c1b8537315f249c Mon Sep 17 00:00:00 2001 From: Stephan Hoogland Date: Thu, 18 Apr 2024 16:44:01 +0200 Subject: [PATCH] Show the missing token scope error instead of an unhandled promise rejection, print the exception --- src/create-tasks.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/create-tasks.ts b/src/create-tasks.ts index 3091dd0..2fd4bfe 100644 --- a/src/create-tasks.ts +++ b/src/create-tasks.ts @@ -23,9 +23,15 @@ export interface CreateTasksOptions { export default async (options: CreateTasksOptions) => { log.info("Creating tasks..."); - const branches = await listBranches(options.branchName); - const branchId = branches.data[0].data.id; - const tasks = await listTasks({ branchId }); + let branches, branchId, tasks; + try { + branches = await listBranches(options.branchName); + branchId = branches.data[0].data.id; + tasks = await listTasks({ branchId }); + } catch (error) { + log.error(JSON.stringify(error)); + throw error; + } await Promise.allSettled( tasks.data