mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 06:00:35 +03:00
Make ErrnoException.errno nothrow pure @nogc @safe
In addition make the ctors (which were @trusted) and tests @safe, but that is not an API change, so it is not in the changelog.
This commit is contained in:
parent
fdbcaedae1
commit
3d4bc84fc4
2 changed files with 10 additions and 5 deletions
|
@ -1610,16 +1610,17 @@ package string errnoString(int errno) nothrow @trusted
|
|||
*/
|
||||
class ErrnoException : Exception
|
||||
{
|
||||
final @property uint errno() { return _errno; } /// Operating system error code.
|
||||
/// Operating system error code.
|
||||
final @property uint errno() nothrow pure @nogc @safe { return _errno; }
|
||||
private uint _errno;
|
||||
/// Constructor which takes an error message. The current global $(REF errno, core,stdc,errno) value is used as error code.
|
||||
this(string msg, string file = null, size_t line = 0) @trusted
|
||||
this(string msg, string file = null, size_t line = 0) @safe
|
||||
{
|
||||
import core.stdc.errno : errno;
|
||||
this(msg, errno, file, line);
|
||||
}
|
||||
/// Constructor which takes an error message and error code.
|
||||
this(string msg, int errno, string file = null, size_t line = 0) @trusted
|
||||
this(string msg, int errno, string file = null, size_t line = 0) @safe
|
||||
{
|
||||
_errno = errno;
|
||||
super(msg ~ " (" ~ errnoString(errno) ~ ")", file, line);
|
||||
|
@ -1627,7 +1628,7 @@ class ErrnoException : Exception
|
|||
}
|
||||
|
||||
///
|
||||
@system unittest
|
||||
@safe unittest
|
||||
{
|
||||
import core.stdc.errno : EAGAIN;
|
||||
auto ex = new ErrnoException("oh no", EAGAIN);
|
||||
|
@ -1635,7 +1636,7 @@ class ErrnoException : Exception
|
|||
}
|
||||
|
||||
/// errno is used by default if no explicit error code is provided
|
||||
@system unittest
|
||||
@safe unittest
|
||||
{
|
||||
import core.stdc.errno : errno, EAGAIN;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue