try…catch will catch user errors, not system errors. Using filesystem is not a user error, thus it wasn’t caught.
try
catch