From 34bf9c5ecabce7500423ba0d1cdd3cfaa25f186b Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 14 Jan 2017 12:26:59 -0500 Subject: tweak JSON read error-handling, update release notes --- release-notes.md | 3 +++ src/StardewModdingAPI/ModHelper.cs | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/release-notes.md b/release-notes.md index bede8849..1c0409ea 100644 --- a/release-notes.md +++ b/release-notes.md @@ -8,6 +8,9 @@ For players: * Fixed issue where SMAPI couldn't be launched from Steam for some Linux players. * Updated list of incompatible mods. +For mod developers: +* Fixed error when reading a custom JSON file from a directory that doesn't exist. + For SMAPI developers: * Added support for specifying a lower bound in mod incompatibility data. * Added support for custom incompatible-mod-version error text. diff --git a/src/StardewModdingAPI/ModHelper.cs b/src/StardewModdingAPI/ModHelper.cs index 7989be74..7304c5ea 100644 --- a/src/StardewModdingAPI/ModHelper.cs +++ b/src/StardewModdingAPI/ModHelper.cs @@ -76,11 +76,7 @@ namespace StardewModdingAPI { json = File.ReadAllText(fullPath); } - catch (FileNotFoundException) - { - return null; - } - catch (DirectoryNotFoundException) + catch (Exception ex) when (ex is DirectoryNotFoundException || ex is FileNotFoundException) { return null; } -- cgit