@@ -11,6 +11,7 @@ import styled from 'styled-components/macro'
1111import { ThemedText } from 'theme'
1212
1313import { AutoColumn } from 'legacy/components/Column'
14+ import CopyHelper from 'legacy/components/Copy'
1415
1516// eslint-disable-next-line import/no-internal-modules -- Direct import to avoid circular dependency (barrel re-exports App which imports ErrorBoundary)
1617import { Title } from 'modules/application/pure/Page'
@@ -61,12 +62,28 @@ const LinkWrapper = styled.div`
6162 padding: 6px 24px;
6263`
6364
65+ const IdText = styled ( ThemedText . Main ) `
66+ opacity: 0.7;
67+ `
68+
69+ const IdRow = styled . div `
70+ display: flex;
71+ align-items: center;
72+ gap: 8px;
73+ flex-wrap: wrap;
74+ `
75+
6476function truncate ( value ?: string ) : string | undefined {
6577 return value ? value . slice ( 0 , 1000 ) : undefined
6678}
6779
68- export const ErrorWithStackTrace = ( { error } : { error : Error } ) : ReactNode => {
69- const encodedBody = encodeURIComponent ( issueBody ( error ) )
80+ interface ErrorWithStackTraceProps {
81+ error : Error
82+ eventId : string
83+ }
84+
85+ export const ErrorWithStackTrace = ( { error, eventId } : ErrorWithStackTraceProps ) : ReactNode => {
86+ const encodedBody = encodeURIComponent ( issueBody ( error , eventId ) )
7087
7188 return (
7289 < >
@@ -77,6 +94,12 @@ export const ErrorWithStackTrace = ({ error }: { error: Error }): ReactNode => {
7794 < img src = { CowError } alt = { t `CowSwap Error` } height = "125" />
7895 </ FlexContainer >
7996 < AutoColumn gap = { 'md' } >
97+ { eventId && (
98+ < IdRow >
99+ < IdText fontSize = { 14 } > Event ID:</ IdText >
100+ < CopyHelper toCopy = { eventId } > { eventId } </ CopyHelper >
101+ </ IdRow >
102+ ) }
80103 < CodeBlockWrapper >
81104 < code >
82105 < ThemedText . Main fontSize = { 10 } >
@@ -91,7 +114,7 @@ export const ErrorWithStackTrace = ({ error }: { error: Error }): ReactNode => {
91114 href = {
92115 CODE_LINK +
93116 `/issues/new?assignees=&labels=🐞 Bug,🔥 Critical&body=${ encodedBody } &title=${ encodeURIComponent (
94- `Crash report: \`${ error . name } ${ error . message && `: ${ truncate ( error . message ) } ` } \`` ,
117+ `Crash report${ eventId ? ` [ ${ eventId } ]` : '' } : \`${ error . name } ${ error . message && `: ${ truncate ( error . message ) } ` } \`` ,
95118 ) } `
96119 }
97120 >
@@ -115,12 +138,21 @@ export const ErrorWithStackTrace = ({ error }: { error: Error }): ReactNode => {
115138 )
116139}
117140
118- function issueBody ( error : Error ) : string {
141+ function issueBody ( error : Error , eventId : string ) : string {
119142 const deviceData = userAgent
143+ const sentryEventUrl = `https://cowprotocol.sentry.io/issues/?query=${ encodeURIComponent ( `id:${ eventId } ` ) } `
120144 return `## URL
121145
122146${ window . location . href }
123147
148+ ## Sentry Event ID
149+
150+ \`\`\`
151+ ${ eventId }
152+ \`\`\`
153+
154+ ${ sentryEventUrl }
155+
124156${
125157 error . name &&
126158 `## Error
0 commit comments