Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix for #886 #887

Merged
merged 1 commit into from

1 participant

@grumpydev
Owner

Throws a more meaningful error message if error traces are on, swallows the error if they're off.

@grumpydev grumpydev merged commit 5883865 into from
@grumpydev grumpydev deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 3, 2013
  1. @grumpydev

    Fix for #886

    grumpydev authored
This page is out of date. Refresh to see the latest.
Showing with 19 additions and 6 deletions.
  1. +19 −6 src/Nancy/Bootstrapper/FavIconApplicationStartup.cs
View
25 src/Nancy/Bootstrapper/FavIconApplicationStartup.cs
@@ -1,5 +1,6 @@
namespace Nancy.Bootstrapper
{
+ using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
@@ -76,12 +77,24 @@ private static byte[] LocateIconOnFileSystem()
if (locatedFavIcons.Any())
{
- var image =
- Image.FromFile(locatedFavIcons.First());
-
- var converter = new ImageConverter();
-
- icon = (byte[])converter.ConvertTo(image, typeof(byte[]));
+ try
+ {
+ var image =
+ Image.FromFile(locatedFavIcons.First());
+
+ var converter = new ImageConverter();
+
+ icon = (byte[])converter.ConvertTo(image, typeof(byte[]));
+ }
+ catch (Exception e)
+ {
+ if (!StaticConfiguration.DisableErrorTraces)
+ {
+ throw new InvalidDataException("Unable to load favicon, please check the format is compatible with GDI+", e);
+ }
+
+ return null;
+ }
}
return icon;
Something went wrong with that request. Please try again.