-
Notifications
You must be signed in to change notification settings - Fork 16
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
Finding issues with Exception class.. #21
Comments
Continuing to poke at this, and reverted back to your original code, it looks like I was making matters worse due to my inexperience. I do still get the fatal errors, but it is returning the exception data in an almost usable way. I am just unsure what I can do about the Fatal error that is being spewed back..
|
Hi @Guyverix! Are you saying that you want to catch the ConnectionException being thrown and do something with it? Or that you're not expecting it to give that message? 🤔 Only asking as you did mention giving it invalid data. |
I am attempting to catch the exception. Both of the exception catches I expected to catch the problem spit the fatal error. I have tried many other catches as well, but am guessing one of these two would be the most likely to work..
I am 100% certain that this is due to my lack of experience with try catch. I figured after 3 days of trying it would just be easier to ask what I was doing wrong :) I am deliberately giving invalid data to write error correction in my application. Invalid IP addresses, wrong community strings, impossible versions, etc. |
I have begun working on using this class, and it works great. However I am running into trouble when invalid information is passed to the class.
I specifically am testing an invalid IP address, as well as invalid community names. Currently I am getting fatal errors in PHP for both. This is against both PHP7.4, as well as PHP8.2 and am having a hell of a time getting the try catch block to work as you designed.
I have been attempting to alter the throw so it does not spew these errors but have not been having any luck there or in making a __construct() within the ConnectionException to attempt to grab the error. I do see the error information when I do a print_r and it returns the object, but suspect that I am not getting all the way to the \Exception class for some reason..
Any suggestions or guidance on how to fix this would be appreciated.. ( Still learning the more complex areas of PHP, and it is biting me in the rear end)
This is what I am attempting to run:
The text was updated successfully, but these errors were encountered: