Quick fix for email false positive message. ISSUE: #1286

This commit is contained in:
Dhruv Bhavsar 2017-03-26 12:15:33 -04:00
parent 3be69cbd61
commit 3f0cc99f56
4 changed files with 33 additions and 27 deletions

View file

@ -227,6 +227,7 @@ namespace Ombi.Services.Notification
catch (Exception e) catch (Exception e)
{ {
Log.Error(e); Log.Error(e);
throw new InvalidOperationException(e.Message);
} }
} }

View file

@ -97,6 +97,7 @@ namespace Ombi.Services.Notification
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex, $"Notification '{notification.NotificationName}' failed with exception"); Log.Error(ex, $"Notification '{notification.NotificationName}' failed with exception");
throw new InvalidOperationException(ex.Message);
} }
} }
} }

View file

@ -642,9 +642,11 @@ namespace Ombi.UI.Modules.Admin
await NotificationService.Publish(notificationModel, settings); await NotificationService.Publish(notificationModel, settings);
Log.Info("Sent email notification test"); Log.Info("Sent email notification test");
} }
catch (Exception) catch (Exception ex)
{ {
Log.Error("Failed to subscribe and publish test Email Notification"); Log.Error("Failed to subscribe and publish test Email Notification");
var msg = "Failed: " + ex.Message;
return Response.AsJson(new JsonResponseModel { Result = false, Message = msg });
} }
finally finally
{ {
@ -653,7 +655,9 @@ namespace Ombi.UI.Modules.Admin
NotificationService.UnSubscribe(new EmailMessageNotification(EmailService)); NotificationService.UnSubscribe(new EmailMessageNotification(EmailService));
} }
} }
return Response.AsJson(new JsonResponseModel { Result = true, Message = "Successfully sent a test Email Notification!" }); return Response.AsJson(new JsonResponseModel { Result = true, Message = "Successfully sent a test Email Notification!" });
} }
private Response SaveEmailNotifications() private Response SaveEmailNotifications()
@ -1299,7 +1303,8 @@ namespace Ombi.UI.Modules.Admin
{ {
var settings = this.Bind<MassEmailSettings>(); var settings = this.Bind<MassEmailSettings>();
Log.Debug("Clicked Admin Mass Email Test"); Log.Debug("Clicked Admin Mass Email Test");
if (settings.Subject == null) { if (settings.Subject == null)
{
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Please Set a Subject" }); return Response.AsJson(new JsonResponseModel { Result = false, Message = "Please Set a Subject" });
} }
if (settings.Body == null) if (settings.Body == null)

View file

@ -122,8 +122,7 @@ namespace Ombi.UI.Modules.Admin
} }
catch (Exception e) catch (Exception e)
{ {
throw e;
throw;
} }
} }
} }