On 11/06/2014 08:47 AM, Suliman wrote:
We have to look at the documentation of the function. In this case the
possibilities are FileException and UTFException.
http://dlang.org/phobos/std_file.html#.readText
However, judging by their names, they are both descendants of
Exception, so what you
We have to look at the documentation of the function. In this
case the possibilities are FileException and UTFException.
http://dlang.org/phobos/std_file.html#.readText
However, judging by their names, they are both descendants of
Exception, so what you are doing will catch either of them.
On 11/05/2014 11:02 PM, Suliman wrote:
Replace that with something like writeln("caught") and you will see
that it is indeed caught. :) Printing the exception mimicks the
default behavior and you (and I) think that the exception is not
caught. :)
that's work, but I can not understand where I ca
Replace that with something like writeln("caught") and you will
see that it is indeed caught. :) Printing the exception mimicks
the default behavior and you (and I) think that the exception
is not caught. :)
that's work, but I can not understand where I can to look at
exception level. If I ri
On 11/05/2014 06:01 AM, Suliman wrote:
> I can't understand what I am missing. Try-catch block also do not handle
> exception:
I does. This turned out to be very tricky for me. :)
> void main()
> {
> string fname = "app.d1"; //file name with error
> string current_folder = (getcwd() ~
Am I right understand that keyword "Exception" is handle
universal type of exceptions?
catch (Exception)
{
writeln("inner");
}
But in my example with try block can I change it's to something
more informative?
On Wed, 05 Nov 2014 14:09:20 +
Gary Willoughby via Digitalmars-d-learn
wrote:
> That shouldn't matter. See: http://dlang.org/exception-safe.html
this indeed matter. and it should.
signature.asc
Description: PGP signature
On Wednesday, 5 November 2014 at 14:04:26 UTC, MadProgressor
wrote:
The scope(failure) is translated to a try catch after the
satement you wann monitor.
So put it before
That shouldn't matter. See: http://dlang.org/exception-safe.html
On Wednesday, 5 November 2014 at 12:56:41 UTC, Suliman wrote:
void openFile(string fname, string current_folder)
{
auto file = readText(current_folder ~ fname);
scope(failure)
{
writeln("failure");
}
// writeln(file);
}
if file name do not e
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(s
void openFile(string fname, string current_folder)
{
auto file = readText(current_folder ~ fname);
scope(failure)
{
writeln("failure");
}
// writeln(file);
}
if file name do not exists, I want to rise scope exception. But
it's do not rise, a
11 matches
Mail list logo