Skip to content

Commit

Permalink
IOException path
Browse files Browse the repository at this point in the history
  • Loading branch information
danmoseley committed Aug 14, 2021
1 parent 42af636 commit 4d992f1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/libraries/Common/src/Interop/Unix/Interop.IOErrors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,14 @@ internal static Exception GetExceptionForIoErrno(ErrorInfo errorInfo, string? pa
goto default;

default:
return GetIOException(errorInfo);
return GetIOException(errorInfo, path);
}
}

internal static Exception GetIOException(Interop.ErrorInfo errorInfo)
internal static Exception GetIOException(Interop.ErrorInfo errorInfo, string? path = null)
{
return new IOException(errorInfo.GetErrorMessage(), errorInfo.RawErrno);
string msg = errorInfo.GetErrorMessage();
return new IOException(
string.IsNullOrEmpty(path) ? msg : $"{msg} : '{path}'", errorInfo.RawErrno);
}
}

0 comments on commit 4d992f1

Please sign in to comment.