Skip to content

Commit d6ebdec

Browse files
W Hörchnermartinnormark
authored andcommitted
Let GetCssBlocks add a warning to the list instead of throwing an exception when a resource could not be downloaded.
1 parent b08ce46 commit d6ebdec

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

PreMailer.Net/PreMailer.Net/PreMailer.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,19 @@ private bool DomainMatch(string domain, string url)
247247
/// </summary>
248248
private IEnumerable<string> GetCssBlocks(IEnumerable<ICssSource> cssSources)
249249
{
250-
return cssSources.Select(styleSource => styleSource.GetCss()).ToList();
250+
return cssSources.Select(GetCssBlock).ToList();
251+
}
252+
private string GetCssBlock(ICssSource cssSource)
253+
{
254+
try
255+
{
256+
return cssSource.GetCss();
257+
}
258+
catch (Exception ex)
259+
{
260+
_warnings.Add(ex.Message);
261+
return string.Empty;
262+
}
251263
}
252264

253265
private void RemoveCssComments(IEnumerable<IElement> cssSourceNodes)

0 commit comments

Comments
 (0)