Skip to content

Commit 34a9a7b

Browse files
committed
use new unkown datatype for response json
1 parent 4df6020 commit 34a9a7b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/api/instagram.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,12 +439,16 @@ export class Instagram<PostType> {
439439
this.responseFromAPI = true;
440440

441441
// Get JSON data
442-
let data: JSON;
442+
let data: unknown;
443443
try {
444444
data = await res.json();
445+
if (typeof data !== "object") {
446+
throw new Error("Response data is not an object");
447+
}
445448
} catch (e) {
446449
this.logger.error("Error processing response JSON");
447450
this.logger.error(e);
451+
continue;
448452
}
449453

450454
// Emit event

0 commit comments

Comments
 (0)