-
Notifications
You must be signed in to change notification settings - Fork 6
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
Emulating CFHTTP's throwOnError feature #6
Comments
@dswitzer yeah I think it would be worth merging into the code for the |
@pfreitag Would you want it implemented as something in the |
I think it's own argument would make sense as the |
@pfreitag I think you could make valid arguments either way. If the purpose of the However, if the purpose of I suppose making it it's own method, bypasses those issues altogether because when you want to "ignore" common exceptions and just get a response, you call the error safe method. I just don't love any of the names I've come up with for the method. 😋 |
While working on replacing CFHTTP with BoltHTTP, I needed to replicate the
throwOnError
option of CFHTTP, so I wanted to share this service layer function I wrote in case it helps anyone else. All it does is capture exceptions and if thethrowOnError
is false, remaps the exceptions to match what CFHTTP returns on similar errors.I thought it worth sharing since it took a little trial and error to figure out the various exceptions and remap them.
I'm not sure if this is worth refactoring into the code or just documented in. It could be easily refactored into a
requestNoError()
orsafeRequest()
helper, or even adding as an attribute to the request method.The text was updated successfully, but these errors were encountered: