add message when API keys are missing
This commit is contained in:
parent
a6d894026f
commit
c063a21530
2 changed files with 6 additions and 1 deletions
|
@ -220,5 +220,8 @@
|
|||
},
|
||||
"error_msg_notattached": {
|
||||
"message": "The product data has not been attached to the storage."
|
||||
},
|
||||
"error_msg_APImissing": {
|
||||
"message": "You have not yet added the API keys. To continue, please add one in the options."
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Import the file module.
|
||||
// import file from `./net.js`;
|
||||
|
||||
const texts = (await import(chrome.runtime.getURL("scripts/read.js"))).default;
|
||||
|
||||
// Don't forget to set the class as export default.
|
||||
export default class gemini {
|
||||
#key;
|
||||
|
@ -15,7 +17,7 @@ export default class gemini {
|
|||
*/
|
||||
constructor (key, model, version = {"API": "v1beta"}) {
|
||||
if ((key) ? (((typeof key).includes(`str`)) ? !(key.trim()) : true) : true) {
|
||||
throw new Error(`The API key is required.`);
|
||||
throw new ReferenceError(texts.localized(`error_msg_APImissing`));
|
||||
};
|
||||
|
||||
// Register the API key privately.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue