Skip to content

Commit

Permalink
IOException path (#57389)
Browse files Browse the repository at this point in the history
  • Loading branch information
danmoseley authored Aug 14, 2021
1 parent 53ebce3 commit b3bb5db
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 b3bb5db

Please sign in to comment.