When using imageio.imageio.read iget a can’t create ImageInputStream. I have a catch exception around it so the program survives but i was wondering if theres a way to put an if statement round it that checks to see if it falied and then attempt to read it again if it did.
basically asking if there is a test for exceptions?
When using imageio.imageio.read iget a can’t create ImageInputStream . I have a catch exception
Share
try…catchis the test for exceptions. If you really want to treat your exception as a loop control mechanism, you can wrap it up something like this:As doublep hints, this is a pretty senseless implementation because it’s unlikely for the problem to go away from one iteration of the loop to the next, so your program will probably just loop endlessly printing error messages.