@@ -88,8 +88,21 @@ async function delay(ms: number): Promise<void> {
8888function createErrorSummary ( errors : ErrorObject [ ] ) : string {
8989 return errors
9090 . map ( ( err : ErrorObject , index : number ) => {
91- const message = err . readableMessage || err . message || "N/A" ;
92- return ` ${ index + 1 } . ${ message } ` ;
91+ // Use the readableMessage if available, otherwise create one
92+ if ( ! err . readableMessage ) {
93+ const severity = categorizeError ( err . message || "" ) ;
94+ let emoji = "️ℹ️" ;
95+ switch ( severity . toLowerCase ( ) ) {
96+ case "high" :
97+ emoji = "🚨" ;
98+ break ;
99+ case "medium" :
100+ emoji = "⚠️" ;
101+ break ;
102+ }
103+ err . readableMessage = `${ emoji } Test Error [${ index + 1 } ]: ${ err . message } ` ;
104+ }
105+ return `${ index + 1 } . ${ err . readableMessage } ` ;
93106 } )
94107 . join ( "\n" ) ;
95108}
@@ -157,6 +170,20 @@ async function initializeServer() {
157170 continue ;
158171 }
159172
173+ // Normalize the errors
174+ parsedMessage . errors = parsedMessage . errors . map (
175+ ( err : any , index : number ) => {
176+ const errorObj = typeof err === "string" ? { message : err } : err ;
177+ return {
178+ message : errorObj . message || "Unknown error" ,
179+ stack : errorObj . stack || "" ,
180+ readableMessage :
181+ errorObj . readableMessage ||
182+ `Test Error [${ index + 1 } ]: ${ errorObj . message } ` ,
183+ } ;
184+ }
185+ ) ;
186+
160187 const errorSummary = createErrorSummary ( parsedMessage . errors ) ;
161188 const formattedTime = formatTimestamp ( parsedMessage . timestamp ) ;
162189 const overallSeverity =
@@ -182,7 +209,7 @@ async function initializeServer() {
182209 // Send initial error report first and wait for confirmation
183210 const initialMessage = `🚨 New Error Report
184211
185- Type: ${ parsedMessage . type }
212+ Type: ${ parsedMessage . type || "errorBatch" }
186213Time: ${ formattedTime }
187214Overall Severity: ${ overallSeverity } ${ severityEmoji }
188215
0 commit comments