Skip to content

Commit

Permalink
fix(clickup): Gracefully degrade if required conditions not met
Browse files Browse the repository at this point in the history
  • Loading branch information
zachelrath committed Nov 20, 2023
1 parent 496ad1a commit b514b73
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions apps/clickup/bundle/bots/load/clickup_tasks_load/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function clickup_tasks_load(bot: LoadBotApi) {
id: "uesio/core.id",
date_created: "uesio/core.created_at",
date_updated: "uesio/core.updated_at",
list_id: `${namespace}.list->id`,
list_id: `${namespace}.list->id`
} as Record<string, string>
Object.entries(collectionMetadata.getAllFieldMetadata()).forEach(
([uesioFieldName, fieldMetadata]) => {
Expand Down Expand Up @@ -144,9 +144,10 @@ export default function clickup_tasks_load(bot: LoadBotApi) {
buildQueryStringConditions()

if (!listId && !taskId) {
throw new Error(
bot.log.warn(
"querying Clickup Tasks requires either a list id or task id condition to be set"
)
return
}

const url = `${bot.getIntegration().getBaseURL()}/${
Expand All @@ -157,8 +158,8 @@ export default function clickup_tasks_load(bot: LoadBotApi) {
method: "GET",
url,
headers: {
"Content-Type": "application/json",
},
"Content-Type": "application/json"
}
})

if (result.code === 200) {
Expand All @@ -174,6 +175,6 @@ export default function clickup_tasks_load(bot: LoadBotApi) {
", status: " +
result.status
)
bot.addError("failed to fetch Tasks: " + result.status)
throw new Error("failed to fetch Tasks: " + result.status)
}
}

0 comments on commit b514b73

Please sign in to comment.