linodego icon indicating copy to clipboard operation
linodego copied to clipboard

feature: Add helper functions for working with errors

Open nesv opened this issue 1 year ago • 0 comments

📝 Description

This pull request adds two functions to the public API for this package:

  • ErrHasStatus(error, ...int) attempts to unwrap the provided error to an *Error and see if its status code matches any of the status codes provided.
  • IsNotFound is a thin wrapper over ErrHasStatus(err, http.StatusNotFound) for a subjectively-common use case.

Implements #460

✔️ How to Test

make testunit

nesv avatar Mar 01 '24 21:03 nesv