fix(organization_ruleset): handle other error responses#2705
fix(organization_ruleset): handle other error responses#2705nickfloyd merged 7 commits intointegrations:mainfrom
Conversation
diofeher
left a comment
There was a problem hiding this comment.
@skeggse Could you please add more context to the pull request's description about how you've fixed the problem and include an automated test demonstrating how this new functionality is expected to resolve the issue linked on the PR?
|
@diofeher Due to the length of time it has taken to get this in, I'll step in and complete the PR description. After running some local tests this is what I came up with: If an error occurs that is NOT a Not return from the function and continue executing and try to access |
|
@nickfloyd Would there be any value in having some kind of regression test for that scenario? Maybe it could be used in the future to ensure other resources don't end up in a similar situation? |
I'm always up for more tests 😉. I think the main challenge here is that, currently our testing suite does not handle integration or e2e scenarios very well. So when testing we have to use a real org and in this case one that has org rulesets. I know @stevehipwell has been working to make that whole experience better as well. |
|
Verified with:
Returns a 404 and not a segfault now. |
|
@nickfloyd this is an instance of the defective error pattern I mentioned on an issue/PR the other week. I think we need to get a general issue open to track resolving the other places where this pattern is present. |
Agreed. I'll try to put an issue together shortly, unless you get to it before I do. |
|
@nickfloyd I've created #2957. |
Resolves #2450
Before the change?
If an error occurs that is NOT a
github.ErrorResponseor is agithub.ErrorResponsewith a status code other than304or404the current implementation will:Not return from the function and continue executing and try to access
resp.Headerandruleset.Name. Since bothrespandrulesetare nil when there's an error we get aSIGSEGVAfter the change?
Pull request checklist
Does this introduce a breaking change?