fix(sonarr): 🐛 Added some more error handling and information around testing sonarr

#4877
This commit is contained in:
tidusjar 2023-03-28 14:01:00 +01:00
commit bd2c2d3901
5 changed files with 31 additions and 18 deletions

View file

@ -3,23 +3,6 @@ namespace Ombi.Api.Sonarr
public class SystemStatus public class SystemStatus
{ {
public string version { get; set; } public string version { get; set; }
public string buildTime { get; set; }
public bool isDebug { get; set; }
public bool isProduction { get; set; }
public bool isAdmin { get; set; }
public bool isUserInteractive { get; set; }
public string startupPath { get; set; }
public string appData { get; set; }
public string osVersion { get; set; }
public bool isMonoRuntime { get; set; }
public bool isMono { get; set; }
public bool isLinux { get; set; }
public bool isOsx { get; set; }
public bool isWindows { get; set; }
public string branch { get; set; }
public string authentication { get; set; }
public string sqliteVersion { get; set; }
public string urlBase { get; set; } public string urlBase { get; set; }
public string runtimeVersion { get; set; }
} }
} }

View file

@ -5,5 +5,6 @@
public bool IsValid { get; set; } public bool IsValid { get; set; }
public string Version { get; set; } public string Version { get; set; }
public string ExpectedSubDir { get; set; } public string ExpectedSubDir { get; set; }
public string AdditionalInformation { get; set; }
} }
} }

View file

@ -2,4 +2,5 @@ export interface ITesterResult {
isValid: boolean; isValid: boolean;
version?: string; version?: string;
expectedSubDir?: string; expectedSubDir?: string;
additionalInformation?: string;
} }

View file

@ -219,9 +219,13 @@ export class SonarrComponent implements OnInit {
this.notificationService.success("Successfully connected to Sonarr!"); this.notificationService.success("Successfully connected to Sonarr!");
} else if (result.expectedSubDir) { } else if (result.expectedSubDir) {
this.notificationService.error("Your Sonarr Base URL must be set to " + result.expectedSubDir); this.notificationService.error("Your Sonarr Base URL must be set to " + result.expectedSubDir);
} else {
if (result.additionalInformation) {
this.notificationService.error(result.additionalInformation);
} else { } else {
this.notificationService.error("We could not connect to Sonarr!"); this.notificationService.error("We could not connect to Sonarr!");
} }
}
}); });
} }

View file

@ -410,6 +410,30 @@ namespace Ombi.Controllers.V1.External
{ {
try try
{ {
if (string.IsNullOrEmpty(settings.ApiKey))
{
return new TesterResultModel
{
IsValid = false,
AdditionalInformation = "NullApiKey"
};
}
if (string.IsNullOrEmpty(settings.Ip))
{
return new TesterResultModel
{
IsValid = false,
AdditionalInformation = "NullIp"
};
}
if (settings.Port <= 0)
{
return new TesterResultModel
{
IsValid = false,
AdditionalInformation = "BadPort"
};
}
var result = await SonarrApi.SystemStatus(settings.ApiKey, settings.FullUri); var result = await SonarrApi.SystemStatus(settings.ApiKey, settings.FullUri);
return new TesterResultModel return new TesterResultModel