From 4d992f1c43310048005fb29f1696394ad73eae0b Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Fri, 13 Aug 2021 22:10:32 -0600 Subject: [PATCH] IOException path --- src/libraries/Common/src/Interop/Unix/Interop.IOErrors.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libraries/Common/src/Interop/Unix/Interop.IOErrors.cs b/src/libraries/Common/src/Interop/Unix/Interop.IOErrors.cs index 14aeddd5adcf4..6c348f9b16463 100644 --- a/src/libraries/Common/src/Interop/Unix/Interop.IOErrors.cs +++ b/src/libraries/Common/src/Interop/Unix/Interop.IOErrors.cs @@ -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); } }