-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add propertyExists() guardian #14
Conversation
Properties must be ensured and fail early before destructuring them, otherwise runtime errors may occur.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this fail the job? Right now it's failing every time too which I want to avoid. I assume there's a happy path that wasn't covered.
With what the job is failing? As for the question, returning with |
We can replace these return statements with |
Tweaked the code a little bit: e308886 Given that we're not aware of the exact reason why certain properties are missing on the responses, I'd let the job fail with meaningful error messages. This way we can trace back the errors and act in response to them. |
What's the plan with this? We shouldn't release another broken version. We should reproduce and fix the issue. |
Alright, makes sense. Then I'll need some info as I can't reproduce the issue. Created an instance of the bot there's no error in my case. Since you also reported the error, could you take a look at your notifications? Isn't there e.g. a system-level notification which doesn't belong to a user? This comment is left unanswered. |
I meant currently the job is failing, but the goal is not to have it fail.
Started failing on July 1st 2020 12:04am with this: mbrn/material-table#1592. Stopped failing July 8th 2020 6:05pm - because the notification is now more than 7 days old. If you extend the 7 days I expect you can reproduce the issue. |
Thanks for this info. This way the error is reproducible but in my case the job fails because of a release notification. I've inspected the response and it seems there's no I'd propose adding the following: const releaseNotification = data.author && !data.user;
if (releaseNotification) {
// terminate the promise
}
Yea, it's most likely because of that. But it's interesting because if the comments are listed for that issue specifically then each object contains the {
"url":"https://api.github.com/repos/mbrn/material-table/issues/comments/652067096",
"html_url":"https://github.com/mbrn/material-table/issues/1592#issuecomment-652067096",
"issue_url":"https://api.github.com/repos/mbrn/material-table/issues/1592",
"id":652067096,
"node_id":"MDEyOklzc3VlQ29tbWVudDY1MjA2NzA5Ng==",
"user":{
"login":"stale[bot]",
"id":26384082,
"node_id":"MDM6Qm90MjYzODQwODI=",
"avatar_url":"https://avatars3.githubusercontent.com/in/1724?v=4",
"gravatar_id":"",
"url":"https://api.github.com/users/stale%5Bbot%5D",
"html_url":"https://github.com/apps/stale",
"followers_url":"https://api.github.com/users/stale%5Bbot%5D/followers",
"following_url":"https://api.github.com/users/stale%5Bbot%5D/following{/other_user}",
"gists_url":"https://api.github.com/users/stale%5Bbot%5D/gists{/gist_id}",
"starred_url":"https://api.github.com/users/stale%5Bbot%5D/starred{/owner}{/repo}",
"subscriptions_url":"https://api.github.com/users/stale%5Bbot%5D/subscriptions",
"organizations_url":"https://api.github.com/users/stale%5Bbot%5D/orgs",
"repos_url":"https://api.github.com/users/stale%5Bbot%5D/repos",
"events_url":"https://api.github.com/users/stale%5Bbot%5D/events{/privacy}",
"received_events_url":"https://api.github.com/users/stale%5Bbot%5D/received_events",
"type":"Bot",
"site_admin":false
},
"created_at":"2020-06-30T21:56:02Z",
"updated_at":"2020-06-30T21:56:02Z",
"author_association":"NONE",
"body":"This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.\n"
} I'm therefore not entirely sure if that's where the issue stems from. Didn't you receive a release notification on 2020-06-30? I'm open to discussing this. |
As a side note, the |
I like the proposal. I've received a release notification for fresh-bot in fact :D And the time matches, so yes that could've caused the issue. I also like the |
Yea, sure: #17 |
Closed in favour of #18. |
This PR adds a
propertyExists()
function to ensure a property on a target object.