From 166dab5eb1d80d8d70b45f5290b985eac45f8073 Mon Sep 17 00:00:00 2001 From: Berkmann18 Date: Thu, 17 Jan 2019 11:56:14 +0000 Subject: [PATCH] fix: changed `error.code` to `error.status` (#54) Due to deprecation warnings, I changed the `code` attribute to `status` to fix [ac-bot#54](https://github.com/all-contributors/all-contributors-bot/issues/54). --- src/Repository/index.js | 2 +- src/utils/getUserDetails.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Repository/index.js b/src/Repository/index.js index 7cd90f3b..31485c4c 100644 --- a/src/Repository/index.js +++ b/src/Repository/index.js @@ -21,7 +21,7 @@ class Repository { path: filePath, }) } catch (error) { - if (error.code === 404) { + if (error.status === 404) { throw new ResourceNotFoundError(filePath, this.full_name) } else { throw error diff --git a/src/utils/getUserDetails.js b/src/utils/getUserDetails.js index 1aec3bd4..f658200e 100644 --- a/src/utils/getUserDetails.js +++ b/src/utils/getUserDetails.js @@ -15,7 +15,7 @@ async function getUserDetials({ github, username }) { try { result = await github.users.getByUsername({ username }) } catch (error) { - if (error.code === 404) { + if (error.status === 404) { throw new UserNotFoundError(username) } else { throw error