From e8581247ca1185f73fbd1e39d6e2872bef54b712 Mon Sep 17 00:00:00 2001 From: Maximilian Berkmann Date: Sat, 19 Jan 2019 01:52:24 +0000 Subject: [PATCH] fix: changed `error.code` to `error.status` (#54) (#55) 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