Skip to content

Commit

Permalink
Check if response is not JSON, throw error, for #367
Browse files Browse the repository at this point in the history
  • Loading branch information
machawk1 committed Oct 10, 2024
1 parent a765902 commit dd374c0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mink-plugin/mink.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,15 @@ async function fetchTimeMap (uri, tabid) {
setTimemapInStorage(data, data.original)
})
.catch(function(err) {
console.log(`Error fetching {uri}`)
console.log(`Error fetching ${uri}`)
console.log(err.message)

if (err.name === 'ZeroMementos') {
showInterfaceForZeroMementos(tabid)
} else if (err.name === 'InaccessibleAggregator') {
log('TODO: swtich up the aggregator')
log('TODO: switch up the aggregator')
} else if (err instanceof SyntaxError) {
log("JSON parsing failed, switch up the aggregator")
}
})
/*
Expand Down Expand Up @@ -521,6 +523,7 @@ chrome.webRequest.onHeadersReceived.addListener(function (deets) {
if (cachedTMKeys.length > 10) { // Keep the cache to a reasonable size through random deletion
log('******* Number of cached URL Headers:')
const indexToRemove = Math.floor(Math.random() * cachedTMKeys.length)
console.log('foo')
const keyOfIndex = cachedTMKeys[indexToRemove]
delete data[keyOfIndex]
}
Expand Down

0 comments on commit dd374c0

Please sign in to comment.