mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 00:53:57 -07:00
Better client side error handling
This commit is contained in:
parent
08d811f7c3
commit
02cf23721a
8 changed files with 12 additions and 20 deletions
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Web.Filters;
|
||||
|
||||
namespace NzbDrone.Web.Controllers
|
||||
{
|
||||
|
@ -27,6 +28,7 @@ namespace NzbDrone.Web.Controllers
|
|||
}
|
||||
|
||||
[HttpGet]
|
||||
[JsonErrorFilter]
|
||||
public JsonResult GetDirectories(string term)
|
||||
{
|
||||
IEnumerable<string> dirs = null;
|
||||
|
@ -38,7 +40,6 @@ namespace NzbDrone.Web.Controllers
|
|||
if (windowsSep > -1)
|
||||
{
|
||||
dirs = _diskProvider.GetDirectories(term.Substring(0, windowsSep + 1));
|
||||
|
||||
}
|
||||
|
||||
//Unix
|
||||
|
@ -55,6 +56,9 @@ namespace NzbDrone.Web.Controllers
|
|||
//Swallow the exceptions so proper JSON is returned to the client (Empty results)
|
||||
}
|
||||
|
||||
if (dirs == null)
|
||||
throw new Exception("A valid path was not provided");
|
||||
|
||||
return Json(dirs, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue