From 7475851bb56c8fa096d7c2f37244dd7d112f5658 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 20 Mar 2014 14:17:00 +1100 Subject: [PATCH] Ensures that we log exceptions instead of completely ignoring them --- src/Umbraco.Web/ImageCropperBaseExtensions.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web/ImageCropperBaseExtensions.cs b/src/Umbraco.Web/ImageCropperBaseExtensions.cs index 93a66a3901..fed0a64d4c 100644 --- a/src/Umbraco.Web/ImageCropperBaseExtensions.cs +++ b/src/Umbraco.Web/ImageCropperBaseExtensions.cs @@ -15,7 +15,7 @@ namespace Umbraco.Web { internal static class ImageCropperBaseExtensions { - + internal static ImageCropData GetImageCrop(this string json, string id) { var ic = new ImageCropData(); @@ -26,7 +26,10 @@ namespace Umbraco.Web var imageCropperSettings = JsonConvert.DeserializeObject>(json); ic = imageCropperSettings.GetCrop(id); } - catch { } + catch (Exception ex) + { + LogHelper.Error(typeof(ImageCropperBaseExtensions), "Could not parse the json string: " + json, ex); + } } return ic; } @@ -40,9 +43,9 @@ namespace Umbraco.Web { imageCrops = JsonConvert.DeserializeObject(json); } - catch(Exception ex) + catch (Exception ex) { - var e = ex; + LogHelper.Error(typeof(ImageCropperBaseExtensions), "Could not parse the json string: " + json, ex); } } @@ -57,7 +60,8 @@ namespace Umbraco.Web return dataset.Crops.GetCrop(cropAlias); } - internal static ImageCropData GetCrop(this IEnumerable dataset, string cropAlias){ + internal static ImageCropData GetCrop(this IEnumerable dataset, string cropAlias) + { if (dataset == null || !dataset.Any()) return null; @@ -92,7 +96,7 @@ namespace Umbraco.Web } } return false; - } + } return false; }