mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-18 21:35:27 -04:00
Improve error message when deleting a profile that is in use
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
using NzbDrone.Common.Exceptions;
|
||||
using System.Net;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
|
||||
namespace NzbDrone.Core.Profiles
|
||||
{
|
||||
public class ProfileInUseException : NzbDroneException
|
||||
public class ProfileInUseException : NzbDroneClientException
|
||||
{
|
||||
public ProfileInUseException(int profileId)
|
||||
: base("Profile [{0}] is in use.", profileId)
|
||||
public ProfileInUseException(string name)
|
||||
: base(HttpStatusCode.BadRequest, "Profile [{0}] is in use.", name)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
@@ -46,7 +46,8 @@ namespace NzbDrone.Core.Profiles
|
||||
{
|
||||
if (_seriesService.GetAllSeries().Any(c => c.ProfileId == id))
|
||||
{
|
||||
throw new ProfileInUseException(id);
|
||||
var profile = _profileRepository.Get(id);
|
||||
throw new ProfileInUseException(profile.Name);
|
||||
}
|
||||
|
||||
_profileRepository.Delete(id);
|
||||
@@ -125,4 +126,4 @@ namespace NzbDrone.Core.Profiles
|
||||
Quality.Bluray1080p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user