(response_text, tool_name)
| 30 | } |
| 31 | |
| 32 | export function parse_google_search_response(response_text, tool_name){ |
| 33 | try { |
| 34 | return clean_google_search_payload(JSON.parse(response_text)); |
| 35 | } catch(e){ |
| 36 | const snippet = truncate_response(response_text); |
| 37 | const details = snippet ? ` Response snippet: ${snippet}` : ''; |
| 38 | throw new Error(`Unexpected non-JSON response from Bright Data` |
| 39 | +` for ${tool_name}.${details}`, {cause: e}); |
| 40 | } |
| 41 | } |
no test coverage detected