I can't understand what I am missing. Try-catch block also do not handle exception:

void main()
{
        string fname = "app.d1"; //file name with error
        string current_folder = (getcwd() ~"\\");
        writeln(current_folder);
        openFile(fname, current_folder);
}

void openFile(string fname, string current_folder)
{
                try
                {
                        auto file = readText(current_folder ~ fname);
                        if(exists(current_folder ~ fname))
                        scope(success)
                                writeln("success");
                }

                catch(Exception e)
                {
                        writeln(e); //what class of error I am handling? any?
                }

        
}

Reply via email to