File tree Expand file tree Collapse file tree 2 files changed +2
-24
lines changed
Expand file tree Collapse file tree 2 files changed +2
-24
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export const eventsTool: ToolConfig<TinybirdEventsParams, TinybirdEventsResponse
1111 description :
1212 'Send events to a Tinybird Data Source using the Events API. Supports JSON and NDJSON formats with optional gzip compression.' ,
1313 version : '1.0.0' ,
14+ errorExtractor : 'nested-error-object' ,
1415
1516 params : {
1617 base_url : {
@@ -100,13 +101,6 @@ export const eventsTool: ToolConfig<TinybirdEventsParams, TinybirdEventsResponse
100101 transformResponse : async ( response : Response ) => {
101102 const data = await response . json ( )
102103
103- if ( ! response . ok ) {
104- const errorMessage =
105- data . error ?. message || data . error || `Failed to send events (HTTP ${ response . status } )`
106- logger . error ( 'Failed to send events to Tinybird' , { status : response . status , error : data } )
107- throw new Error ( errorMessage )
108- }
109-
110104 logger . info ( 'Successfully sent events to Tinybird' , {
111105 successful : data . successful_rows ,
112106 quarantined : data . quarantined_rows ,
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export const queryTool: ToolConfig<TinybirdQueryParams, TinybirdQueryResponse> =
1818 name : 'Tinybird Query' ,
1919 description : 'Execute SQL queries against Tinybird Pipes and Data Sources using the Query API.' ,
2020 version : '1.0.0' ,
21+ errorExtractor : 'nested-error-object' ,
2122
2223 params : {
2324 base_url : {
@@ -71,23 +72,6 @@ export const queryTool: ToolConfig<TinybirdQueryParams, TinybirdQueryResponse> =
7172 const responseText = await response . text ( )
7273 const contentType = response . headers . get ( 'content-type' ) || ''
7374
74- if ( ! response . ok ) {
75- // Try to parse error as JSON first
76- let errorMessage = `Failed to execute query (HTTP ${ response . status } )`
77- try {
78- const errorData = JSON . parse ( responseText )
79- errorMessage = errorData . error ?. message || errorData . error || errorMessage
80- } catch {
81- // If not JSON, use raw text (truncated if too long)
82- errorMessage = responseText ? responseText . substring ( 0 , 500 ) : errorMessage
83- }
84- logger . error ( 'Failed to execute Tinybird query' , {
85- status : response . status ,
86- error : errorMessage ,
87- } )
88- throw new Error ( errorMessage )
89- }
90-
9175 // Check if response is JSON based on content-type or try parsing
9276 const isJson = contentType . includes ( 'application/json' ) || contentType . includes ( 'text/json' )
9377
You can’t perform that action at this time.
0 commit comments