@@ -43,6 +43,12 @@ const TOOL_FORMATTERS: Record<string, ToolFormatter> = {
4343 : `Searched for issues${ projectInfo } : '${ question } '` ;
4444 }
4545
46+ if ( dataset === 'errors' ) {
47+ return isLoading
48+ ? `Searching for errors${ projectInfo } : '${ question } '...`
49+ : `Searched for errors${ projectInfo } : '${ question } '` ;
50+ }
51+
4652 // Default to spans
4753 return isLoading
4854 ? `Querying spans${ projectInfo } : '${ question } '...`
@@ -343,6 +349,43 @@ export function buildToolLinkUrl(
343349 } ;
344350 }
345351
352+ if ( dataset === 'errors' ) {
353+ const queryParams : Record < string , any > = {
354+ dataset : 'errors' ,
355+ queryDataset : 'error-events' ,
356+ query : query || '' ,
357+ project : null ,
358+ } ;
359+
360+ if ( stats_period ) {
361+ queryParams . statsPeriod = stats_period ;
362+ }
363+
364+ // If project_slugs is provided, look up the project IDs
365+ if ( project_slugs && project_slugs . length > 0 && projects ) {
366+ const projectIds = project_slugs
367+ . map ( ( slug : string ) => projects . find ( p => p . slug === slug ) ?. id )
368+ . filter ( ( id : string | undefined ) => id !== undefined ) ;
369+ if ( projectIds . length > 0 ) {
370+ queryParams . project = projectIds ;
371+ }
372+ }
373+
374+ const { y_axes} = toolLink . params ;
375+ if ( y_axes ) {
376+ queryParams . yAxis = y_axes ;
377+ }
378+
379+ if ( sort ) {
380+ queryParams . sort = sort ;
381+ }
382+
383+ return {
384+ pathname : `/organizations/${ orgSlug } /explore/discover/homepage/` ,
385+ query : queryParams ,
386+ } ;
387+ }
388+
346389 // Default to spans (traces) search
347390 const { y_axes, group_by, mode} = toolLink . params ;
348391
0 commit comments