MCPcopy Index your code
hub / github.com/simstudioai/sim / formatIssueContent

Function formatIssueContent

apps/sim/connectors/sentry/sentry.ts:299–343  ·  view source on GitHub ↗

* Formats an issue and its latest event into a single plain-text document covering the * title, culprit, counts, the latest event's message/exception, and event tags.

(issue: SentryIssue, event: SentryEvent | null)

Source from the content-addressed store, hash-verified

297 * title, culprit, counts, the latest event's message/exception, and event tags.
298 */
299function formatIssueContent(issue: SentryIssue, event: SentryEvent | null): string {
300 const parts: string[] = []
301
302 parts.push(`Issue: ${buildTitle(issue)}`)
303 if (issue.shortId) parts.push(`Short ID: ${issue.shortId}`)
304 if (issue.culprit) parts.push(`Culprit: ${issue.culprit}`)
305 if (issue.level) parts.push(`Level: ${issue.level}`)
306 if (issue.status) parts.push(`Status: ${issue.status}`)
307 if (issue.platform) parts.push(`Platform: ${issue.platform}`)
308 if (issue.count) parts.push(`Events: ${issue.count}`)
309 if (issue.userCount != null) parts.push(`Users affected: ${issue.userCount}`)
310 if (issue.firstSeen) parts.push(`First seen: ${issue.firstSeen}`)
311 if (issue.lastSeen) parts.push(`Last seen: ${issue.lastSeen}`)
312
313 if (event) {
314 const message = event.message?.trim() || event.title?.trim()
315 if (message) {
316 parts.push('')
317 parts.push('--- Latest Event ---')
318 if (event.dateCreated) parts.push(`Occurred: ${event.dateCreated}`)
319 parts.push(message)
320 }
321
322 const exceptionEntry = event.entries?.find((entry) => entry.type === 'exception')
323 if (exceptionEntry?.data) {
324 const exceptionLines = formatException(exceptionEntry.data as SentryExceptionData)
325 if (exceptionLines.length > 0) {
326 parts.push('')
327 parts.push('--- Exception ---')
328 parts.push(...exceptionLines)
329 }
330 }
331
332 const tagLines = (event.tags ?? [])
333 .map((tag) => (tag.key && tag.value ? `${tag.key}: ${tag.value}` : undefined))
334 .filter((line): line is string => Boolean(line))
335 if (tagLines.length > 0) {
336 parts.push('')
337 parts.push('--- Tags ---')
338 parts.push(...tagLines)
339 }
340 }
341
342 return parts.join('\n').trim()
343}
344
345/**
346 * Fetches the latest event for an issue. Returns null when the issue has no events or the

Callers 1

sentry.tsFile · 0.85

Calls 4

formatExceptionFunction · 0.85
joinMethod · 0.80
buildTitleFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected