Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Commit

Permalink
v2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael authored Dec 28, 2019
2 parents f623149 + 020b138 commit 91ec1d1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "traktflix",
"version": "2.1.0",
"version": "2.1.1",
"description": "A Trakt.tv scrobbler for Netflix.",
"author": "tegon",
"private": true,
Expand Down
3 changes: 3 additions & 0 deletions src/class/Request.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ class Request {
if (!Shared.isBackgroundPage() && !options.url.match(location.host)) {
try {
const response = await browser.runtime.sendMessage({ type: `request`, options: JSON.stringify(options) });
if (response.error) {
throw response;
}
options.success(response);
} catch (error) {
options.error(error.status, error.responseText, error.options);
Expand Down
7 changes: 4 additions & 3 deletions src/modules/background/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if (chrome && chrome.declarativeContent) {
}

browser.runtime.onMessage.addListener((request, sender) => {
return new Promise(async (resolve, reject) => {
return new Promise(async resolve => {
switch (request.type) {
case `getApiDefs`:
// noinspection JSIgnoredPromiseFromCall
Expand Down Expand Up @@ -113,8 +113,9 @@ browser.runtime.onMessage.addListener((request, sender) => {
try {
const response = await Request.sendAndWait(options);
resolve(response);
} catch (error) {
reject(error);
} catch (response) {
response.error = true;
resolve(response);
}
return;
}
Expand Down

0 comments on commit 91ec1d1

Please sign in to comment.