Merge pull request #796 from mendableai/fix/issue-663

[BUG-SDK] missing error in response
This commit is contained in:
Nicolas 2024-10-21 12:24:57 -03:00 committed by GitHub
commit 9ab922837c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -81,8 +81,10 @@ class FirecrawlApp:
response = response.json()
if response['success'] and 'data' in response:
return response['data']
else:
elif "error" in response:
raise Exception(f'Failed to scrape URL. Error: {response["error"]}')
else:
raise Exception(f'Failed to scrape URL. Error: {response}')
else:
self._handle_error(response, 'scrape URL')
@ -266,8 +268,10 @@ class FirecrawlApp:
response = response.json()
if response['success'] and 'links' in response:
return response
else:
elif 'error' in response:
raise Exception(f'Failed to map URL. Error: {response["error"]}')
else:
raise Exception(f'Failed to map URL. Error: {response}')
else:
self._handle_error(response, 'map')