-
Notifications
You must be signed in to change notification settings - Fork 62
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
Improve error_log & error pass-back; Add getTicket(); Silence verbose logging; Link to repo #42
base: master
Are you sure you want to change the base?
Conversation
Helps as the class gets added to code-bases, easier to track it
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.
Looks good overall, but it might be nice to make a couple tweaks. See my other comments for details on what I mean.
pve2_api.class.php
Outdated
error_log("Error - Invalid HTTP Response.\n" . var_export($split_headers, true)); | ||
throw new PVE2_Exception("PVE2 API: Error - Invalid HTTP Response.\n" . var_export($split_headers, true)); | ||
return false; |
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.
Throw/return paradox again.
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.
Not sure if you want everything reverted to error_log. Excepting is helpful as we can expect a proper reply in integrated apps, and relay the error specifics to the end user. So I'm hesitant to revert everything?
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.
All I meant was that once you throw
, the return
never gets called.
pve2_api.class.php
Outdated
error_log("\$action_response_array['data'] is empty. Returning false.\n" . | ||
throw new PVE2_Exception("PVE2 API: \$action_response_array['data'] is empty. Returning false.\n" . | ||
var_export($action_response_array['data'], true)); | ||
return false; |
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.
Throw/return paradox again.
Thanks for the review @danhunsaker - how's the updated pull looking now? Appreciate your pointers on all fronts. I'd like to switch back the reverted-to-error-log section? I'm a fan of passing back the specifics if it's doable. |
Helps as the class gets added to code-bases, easier to track it. You weren't wrong about not working with it!
Investigate @danhunsaker concept of PSR-3 handling mentioned in Issue #19 back in 2015.
https://www.php-fig.org/psr/psr-3/