Skip to content

Commit

Permalink
Merge pull request #62 from nasa-petal/fix-ss-safari
Browse files Browse the repository at this point in the history
Fix Safari Semantic Scholar issue
  • Loading branch information
bruffridge authored Mar 8, 2024
2 parents cc7505a + fd62503 commit b6cc1ff
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/assistant/bidaraFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,14 @@ export async function ssSearch(params) {
try {
const response = await fetch("https://api.semanticscholar.org/graph/v1/paper/search?" + searchParams);

if (response.status === 429) {
if (response.status === 429 || response.code === 429 || response.statusCode === 429) {
return "Semantic Scholar is currently having issues with their servers. So, for now, searching for academic papers will not work."
}
const papers = await response.json();
return JSON.stringify(papers);
} catch (e) {
if (e instanceof TypeError && e.message === 'Failed to fetch') {
return "Semantic Scholar is currently having issues with their servers. So, for now, searching for academic papers will not work."
}

throw e;
console.error('error: ' + e);
return "Semantic Scholar is currently having issues with their servers. So, for now, searching for academic papers will not work."
}
}

Expand Down

0 comments on commit b6cc1ff

Please sign in to comment.