Skip to content

Commit 6234677

Browse files
committed
Added notice when an API key is missing
1 parent 08ca5e1 commit 6234677

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/api/apis/MobyGamesAPI.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { APIModel } from '../APIModel';
2+
import { Notice } from 'obsidian';
23
import { MediaTypeModel } from '../../models/MediaTypeModel';
34
import MediaDbPlugin from '../../main';
45
import { GameModel } from '../../models/GameModel';
@@ -23,6 +24,7 @@ export class MobyGamesAPI extends APIModel {
2324

2425
if (!this.plugin.settings.MobyGamesKey) {
2526
console.error(new Error(`MDB | API key for ${this.apiName} missing.`));
27+
new Notice(`MediaDB | API key for ${this.apiName} missing.`);
2628
return [];
2729
}
2830

@@ -66,6 +68,7 @@ export class MobyGamesAPI extends APIModel {
6668
console.log(`MDB | api "${this.apiName}" queried by ID`);
6769

6870
if (!this.plugin.settings.MobyGamesKey) {
71+
new Notice(`MediaDB | API key for ${this.apiName} missing.`);
6972
throw Error(`MDB | API key for ${this.apiName} missing.`);
7073
}
7174

src/api/apis/OMDbAPI.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { APIModel } from '../APIModel';
2+
import { Notice } from 'obsidian';
23
import { MediaTypeModel } from '../../models/MediaTypeModel';
34
import { MovieModel } from '../../models/MovieModel';
45
import MediaDbPlugin from '../../main';
@@ -30,6 +31,7 @@ export class OMDbAPI extends APIModel {
3031

3132
if (!this.plugin.settings.OMDbKey) {
3233
console.error(new Error(`MDB | API key for ${this.apiName} missing.`));
34+
new Notice(`MediaDB | API key for ${this.apiName} missing.`);
3335
return [];
3436
}
3537

@@ -108,6 +110,7 @@ export class OMDbAPI extends APIModel {
108110
console.log(`MDB | api "${this.apiName}" queried by ID`);
109111

110112
if (!this.plugin.settings.OMDbKey) {
113+
new Notice(`MediaDB | API key for ${this.apiName} missing.`);
111114
throw Error(`MDB | API key for ${this.apiName} missing.`);
112115
}
113116

0 commit comments

Comments
 (0)