File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1457,6 +1457,10 @@ class ErrnoException : Exception
14571457 this (string msg, string file = null , size_t line = 0 ) @trusted
14581458 {
14591459 import core.stdc.errno : errno;
1460+ this (msg, errno, file, line);
1461+ }
1462+ this (string msg, int errno, string file = null , size_t line = 0 ) @trusted
1463+ {
14601464 import core.stdc.string : strlen;
14611465
14621466 _errno = errno;
@@ -1473,6 +1477,25 @@ class ErrnoException : Exception
14731477 }
14741478 super (msg ~ " (" ~ s[0 .. s.strlen].idup ~ " )" , file, line);
14751479 }
1480+
1481+ unittest
1482+ {
1483+ import core.stdc.errno : errno, EAGAIN ;
1484+
1485+ auto old = errno;
1486+ scope (exit) errno = old;
1487+
1488+ errno = EAGAIN ;
1489+ auto ex = new ErrnoException(" oh no" );
1490+ assert (ex.errno == EAGAIN );
1491+ }
1492+
1493+ unittest
1494+ {
1495+ import core.stdc.errno : EAGAIN ;
1496+ auto ex = new ErrnoException(" oh no" , EAGAIN );
1497+ assert (ex.errno == EAGAIN );
1498+ }
14761499}
14771500
14781501/+ +
You can’t perform that action at this time.
0 commit comments