internal PSObjectDisposedException NewObjectDisposedException( string objectName) { string message = !string.IsNullOrEmpty(objectName) ? ResourceManagerCache.FormatResourceString(Assembly.GetAssembly(typeof(PSObject)), "AutomationExceptions", "ObjectDisposed", (object)objectName) : throw this.NewArgumentNullException(nameof(objectName)); PSObjectDisposedException disposedException = new PSObjectDisposedException(objectName, message); this.TraceException((Exception)disposedException); return(disposedException); }
/// <summary> /// Traces the Message and StackTrace properties of the exception /// and returns the new exception. This variant uses the default /// ObjectDisposedException template text. This is not allowed to call /// other Throw*Exception variants, since they call this. /// </summary> /// <param name="objectName"> /// The name of the disposed object /// </param> /// <returns>Exception instance ready to throw</returns> /// <remarks> /// Note that the parameter is the object name and not the message. /// </remarks> internal static PSObjectDisposedException NewObjectDisposedException(string objectName) { if (String.IsNullOrEmpty(objectName)) { throw NewArgumentNullException("objectName"); } string message = StringUtil.Format(AutomationExceptions.ObjectDisposed, objectName); var e = new PSObjectDisposedException(objectName, message); return(e); }
/// <summary> /// Traces the Message and StackTrace properties of the exception /// and returns the new exception. This variant uses the default /// ObjectDisposedException template text. This is not allowed to call /// other Throw*Exception variants, since they call this. /// </summary> /// <param name="objectName"> /// The name of the disposed object /// </param> /// <returns>Exception instance ready to throw</returns> /// <remarks> /// Note that the parameter is the object name and not the message. /// </remarks> internal static PSObjectDisposedException NewObjectDisposedException(string objectName) { if (String.IsNullOrEmpty(objectName)) { throw NewArgumentNullException("objectName"); } string message = StringUtil.Format(AutomationExceptions.ObjectDisposed, objectName); var e = new PSObjectDisposedException(objectName, message); return e; }