Getting model by invalid ID throws a more specific exception.

This commit is contained in:
Keivan Beigi 2013-07-09 15:06:30 -07:00
commit 54c36e9264
8 changed files with 38 additions and 11 deletions

View file

@ -68,8 +68,15 @@ namespace NzbDrone.Api.REST
Get[ID_ROUTE] = options =>
{
ValidateId(options.Id);
var resource = GetResourceById((int)options.Id);
return resource.AsResponse();
try
{
var resource = GetResourceById((int)options.Id);
return resource.AsResponse();
}
catch (ModelNotFoundException)
{
return new NotFoundResponse();
}
};
}
}