Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions apps/web/src/lib/server/events/targets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,18 @@ async function getIntegrationTargets(
const secrets = decryptSecrets<{ accessToken?: string }>(m.secrets)
accessToken = secrets.accessToken
} catch (error) {
log.error({ err: error, integration_type: m.integrationType }, 'failed to decrypt integration secrets')
log.error(
{ err: error, integration_type: m.integrationType },
'failed to decrypt integration secrets'
)
continue
}
}

targets.push({
type: m.integrationType,
target: { channelId },
config: { accessToken, rootUrl: context.portalBaseUrl },
config: { ...integrationConfig, accessToken, rootUrl: context.portalBaseUrl },
})
}

Expand Down
11 changes: 6 additions & 5 deletions apps/web/src/lib/server/integrations/azure-devops/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ async function azureDevOpsApi(

if (!response.ok) {
const status = response.status
if (status === 401) throw Object.assign(new Error('Unauthorized'), { status })
if (status === 403) throw Object.assign(new Error('Forbidden'), { status })
if (status === 429) throw Object.assign(new Error('Rate limited'), { status })
if (status >= 500) throw Object.assign(new Error(`Server error ${status}`), { status })
throw Object.assign(new Error(`HTTP ${status}`), { status })
const detail = await response.text().catch(() => '')
if (status === 401) throw Object.assign(new Error('Unauthorized'), { status, detail })
if (status === 403) throw Object.assign(new Error('Forbidden'), { status, detail })
if (status === 429) throw Object.assign(new Error('Rate limited'), { status, detail })
if (status >= 500) throw Object.assign(new Error(`Server error ${status}`), { status, detail })
throw Object.assign(new Error(`HTTP ${status}: ${detail}`), { status, detail })
}

return response
Expand Down