Skip to content

Commit

Permalink
add title parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
daibhin committed Mar 18, 2024
1 parent b26e52a commit 2142c82
Showing 1 changed file with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ export function SessionRecordingErrors(): JSX.Element {
{
title: 'Error',
dataIndex: 'cluster',
render: (_, cluster) => (
<div
title={cluster.sample.error}
className="font-semibold text-sm text-default line-clamp-1"
>
{cluster.sample.error}
</div>
),
render: (_, cluster) => {
const displayTitle = parseTitle(cluster.sample.error)
return (
<div title={displayTitle} className="font-semibold text-sm text-default line-clamp-1">
{displayTitle}
</div>
)
},
width: '50%',
},
{
Expand Down Expand Up @@ -124,3 +124,12 @@ function isJSON(str: string): boolean {
return false
}
}

function parseTitle(error: string): string {
try {
const parsedError = JSON.parse(error)
return parsedError.error || error
} catch {
return error
}
}

0 comments on commit 2142c82

Please sign in to comment.