Forum > General
How to Capture a File Not Found Exception?
GetMem:
@Kays
--- Quote ---I don’t think the “old way” would use exceptions at all. Besides, IOResult does have many other results
--- End quote ---
I agree with the exception part, I wouldn't even use an exception here, but that is not my concern.
By old I was referring to IOResult, when I learned to programming in the 90', it was already obsolete.
PascalDragon:
--- Quote from: StephenMilner on January 14, 2022, 05:06:15 pm ---The exception
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---EFileNotFoundException doesn't appear to be the correct one.
The final exception raised is:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---EInOutError: File not found
Should I use
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---EInOutError instead of
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---EFileNotFoundException?
--- End quote ---
Correct. If I/O exceptions are enabled it's always converted to an EInOutError.
--- Quote from: StephenMilner on January 14, 2022, 05:06:15 pm ---How do I differentiate between other kinds of input/output errors in my exception handling?
--- End quote ---
You can get the I/O result code from the exception with EInOutError.ErrorCode. For a list of error codes see here.
Navigation
[0] Message Index
[*] Previous page