Skip to content

Commit

Permalink
feat: set error.response (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m authored Jun 12, 2021
1 parent 1235c12 commit 534b562
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
20 changes: 10 additions & 10 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"dependencies": {
"@octokit/auth-oauth-app": "^4.3.0",
"@octokit/auth-oauth-user": "^1.2.3",
"@octokit/request": "^5.4.11",
"@octokit/request-error": "^2.0.0",
"@octokit/request": "^5.6.0",
"@octokit/request-error": "^2.1.0",
"@octokit/types": "^6.0.3",
"@types/lru-cache": "^5.1.0",
"deprecation": "^2.3.1",
Expand Down
5 changes: 3 additions & 2 deletions src/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ export async function hook(

// If the date header is missing, we can't correct the system time skew.
// Throw the error to be handled upstream.
if (typeof error.headers.date === "undefined") {
if (typeof error.response.headers.date === "undefined") {
throw error;
}

const diff = Math.floor(
(Date.parse(error.headers.date) - Date.parse(new Date().toString())) /
(Date.parse(error.response.headers.date) -
Date.parse(new Date().toString())) /
1000
);

Expand Down

0 comments on commit 534b562

Please sign in to comment.