Skip to content

Commit

Permalink
Merge pull request #8859 from jtbx/ErrnoException.errnomsg
Browse files Browse the repository at this point in the history
Add errnoMsg property to ErrnoException
  • Loading branch information
dkorpel authored Jan 5, 2024
2 parents 73a54e2 + 04c6590 commit 2dacb0e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion std/exception.d
Original file line number Diff line number Diff line change
Expand Up @@ -1632,6 +1632,9 @@ class ErrnoException : Exception
/// Operating system error code.
final @property uint errno() nothrow pure scope @nogc @safe { return _errno; }
private uint _errno;
/// Localized error message generated through $(REF strerror_r, core,stdc,string) or $(REF strerror, core,stdc,string).
final @property string errnoMsg() nothrow pure scope @nogc @safe { return _errnoMsg; }
private string _errnoMsg;
/// 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) @safe
{
Expand All @@ -1642,7 +1645,8 @@ class ErrnoException : Exception
this(string msg, int errno, string file = null, size_t line = 0) @safe
{
_errno = errno;
super(msg ~ " (" ~ errnoString(errno) ~ ")", file, line);
_errnoMsg = errnoString(errno);
super(msg ~ " (" ~ errnoMsg ~ ")", file, line);
}
}

Expand Down

0 comments on commit 2dacb0e

Please sign in to comment.