public string GetMetadataAndThrow(string attributeName, Exception exception)
{
if (attributeName == null)
throw new ArgumentNullException("attributeName");
if (string.IsNullOrEmpty(attributeName))
throw new ArgumentException("attributeName cannot be null or empty");
if (HasItemBeenDeleted)
throw new InvalidOperationException("The item has been deleted.");
Debug.Assert(!String.IsNullOrEmpty(attributeName), "Cannot retrieve an attribute for a null or empty attribute name");
string attribute = GetMetadata(attributeName);
if(String.IsNullOrEmpty(attributeName) && exception != null)
{
if(String.IsNullOrEmpty(exception.Message))
{
Debug.Assert(!String.IsNullOrEmpty(this.ProjectManager.BaseUri.AbsoluteUrl), "Cannot retrieve an attribute for a project that does not have a name");
string message = String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.AttributeLoad, CultureInfo.CurrentUICulture), attributeName, this.ProjectManager.BaseUri.AbsoluteUrl);
throw new InvalidOperationException(message, exception);
}
throw exception;
}
return attribute;
}