/// <summary> /// Create a new <see cref="ArtifactSummary"/> instance from a set of harvested artifact summary properties /// and a runtime exception that occured during harvesting. /// </summary> public ArtifactSummary(IArtifactSummaryPropertyBag properties, Exception error) { this.properties = properties ?? throw Errors.ArgumentNull(nameof(properties)); this.Error = error; // Try to parse the specified type name to a known enum value var typeName = ResourceTypeName; if (typeName != null) { ResourceType = ModelInfo.FhirTypeNameToResourceType(ResourceTypeName); } }
/// <summary>Create a new <see cref="ArtifactSummary"/> instance from the specified exception.</summary> /// <param name="error">An exception that occured while harvesting artifact summary information.</param> /// <param name="origin">The original location of the target artifact.</param> public static ArtifactSummary FromException(Exception error, string origin) { if (error == null) { throw Errors.ArgumentNull(nameof(error)); } // Create a new (default) ArtifactSummaryPropertyBag to store the artifact origin var properties = new ArtifactSummaryPropertyBag(); if (!string.IsNullOrEmpty(origin)) { properties[ArtifactSummaryProperties.OriginKey] = origin; } return(new ArtifactSummary(properties, error)); }