From 0247aebb25e401011c90434f0714b09d21c46e14 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sat, 8 Feb 2014 11:44:38 -0800 Subject: [PATCH] Fixed: Adding an invalid root folder will show a usable error message --- src/NzbDrone.Api/RootFolders/RootFolderModule.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Api/RootFolders/RootFolderModule.cs b/src/NzbDrone.Api/RootFolders/RootFolderModule.cs index 6691032d8..5d0298698 100644 --- a/src/NzbDrone.Api/RootFolders/RootFolderModule.cs +++ b/src/NzbDrone.Api/RootFolders/RootFolderModule.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using FluentValidation; +using FluentValidation.Results; using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.RootFolders; using NzbDrone.Api.Mapping; @@ -30,7 +33,15 @@ namespace NzbDrone.Api.RootFolders private int CreateRootFolder(RootFolderResource rootFolderResource) { - return GetNewId(_rootFolderService.Add, rootFolderResource); + try + { + return GetNewId(_rootFolderService.Add, rootFolderResource); + } + catch (Exception ex) + { + throw new ValidationException(new [] { new ValidationFailure("Path", ex.Message) }); + } + } private List GetRootFolders()