Skip to content

Commit

Permalink
Alert the user, when we couldn't save the dev tool options
Browse files Browse the repository at this point in the history
  • Loading branch information
leonvogt committed Jun 3, 2024
1 parent 8aa34b9 commit 659fb04
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/lib/devtool.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,20 @@ export default class Devtool {

saveOptions = (options) => {
const newOptions = { ...this.options, ...options }
chrome.storage.sync.set({ options: newOptions })
this.options = newOptions

chrome.storage.sync.set({ options: newOptions }, () => {
if (chrome.runtime.lastError) {
const error = chrome.runtime.lastError
console.error("Hotwire Dev Tools: Error saving data:", error)
if (error.message.includes("MAX_WRITE_OPERATIONS_PER_MINUTE")) {
alert("Hotwire Dev Tools: Whoops! We are sorry but you've reached the maximum number of options changes allowed per minute. Please try again later.")
return
}
} else {
// Data saved successfully
this.options = newOptions
}
})
}

detailPanelCSS = async () => {
Expand Down

0 comments on commit 659fb04

Please sign in to comment.