I want to generate a file through randomly selecting an index from a list. That works. However, I occasionally get the error: ERR_FILE_NOT_FOUND
.
I tried using the try.. catch
statement but that doesn't quite achieve what I would like.
I'm not familiar with JavaScript, but I know in python I could do something like:
while True:
# generate the image
try:
# do stuff
except Exception:
# do nothing so it regenerates an image
else:
break
This doesn't work in JavaScript, the "else" says it expects a decision.