-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update APIError struct to use new NullAPIErrorObject type for safety
I discovered that my initial implementation of the APIError type's NotFound() method had the potential for triggering a nil pointer dereference panic, which wouldn't be a great experience for someone dealing with PagerDuty code. I provided a fix in #271, but in doing so I remembered this pattern from the `database/sql` package and decided that, while not as nice to use, it was a much safer API to reduce the chances of the consumer accidentally triggering a panic in their program. Since we've yet to release v1.4.0 (i.e., the new APIError type still hasn't been released) we can still change this without breaking API compatibility guarantees.
- Loading branch information
Showing
2 changed files
with
85 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters