internal BackgroundCopyException(IBackgroundCopyError err) { const uint lang = 0x1; // LANG_NEUTRAL, SUBLANG_DEFAULT err.GetError(out ctx, out code); try { err.GetErrorContextDescription(lang, out ctxDesc); } catch { ctxDesc = unkErr; } try { err.GetErrorDescription(lang, out errDesc); } catch { errDesc = unkErr; } err.GetProtocol(out protocol); err.GetFile(out iVal); }
internal BackgroundCopyException(IBackgroundCopyError err) { const uint lang = 0x1; // LANG_NEUTRAL, SUBLANG_DEFAULT err.GetError(out ctx, out code); try { ctxDesc = err.GetErrorContextDescription(lang); } catch { ctxDesc = SafeCoTaskMemString.Null; } try { errDesc = err.GetErrorDescription(lang); } catch { errDesc = SafeCoTaskMemString.Null; } try { protocol = err.GetProtocol(); } catch { protocol = SafeCoTaskMemString.Null; } iVal = err.GetFile(); }
/// <summary> /// Creates an exception with the BITS error reference and a language id. /// </summary> /// <param name="error">The BITS error reference.</param> /// <param name="langID">The language Id.</param> internal BitsDownloadErrorException(IBackgroundCopyError error, uint langID) { IBackgroundCopyFile file; error.GetError(out contextForError, out errorCode); error.GetErrorContextDescription(langID, out contextDescription); error.GetErrorDescription(langID, out errorDescription); error.GetFile(out file); error.GetProtocol(out protocol); file.GetLocalName(out fileLocalName); file.GetRemoteName(out fileRemoteName); }