Permalink
Browse files

Fix NRE, when the user didn't authenticate against the server when do…

…ing a backup
  • Loading branch information...
1 parent b8bed90 commit 18b520fd47dc40bf4d438c4ed4fcd60d60a2bd4a @fitzchak fitzchak committed Apr 2, 2012
@@ -7,7 +7,7 @@ namespace Raven.Studio.Commands
{
public class BackupCommand : Command
{
- private StartBackupTask startBackupTask;
+ private readonly StartBackupTask startBackupTask;
public BackupCommand(StartBackupTask startBackupTask)
{
this.startBackupTask = startBackupTask;
@@ -22,12 +22,13 @@ public override void Execute(object _)
DatabaseCommands.StartBackupAsync(location.Value)
.ContinueWith(task =>
- {
- startBackupTask.Status = new BackupStatus
- {
- IsRunning = true
- };
- }).Catch();
+ {
+ task.Wait(); // throws
+ startBackupTask.Status = new BackupStatus
+ {
+ IsRunning = true
+ };
+ }).Catch();
}
}
}
@@ -73,7 +73,7 @@ private static void SetCustomMessageBasedOnTheActualError(StringWriter writer, E
{
case HttpStatusCode.Unauthorized:
case HttpStatusCode.Forbidden:
- WriteCustomMessage("Could not authenticate against server", writer);
+ WriteCustomMessage("Could not authenticate against the server", writer);
break;
default:
using (var streamReader = new StreamReader(webResponse.GetResponseStream()))
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
using System.Linq;
-using System.Text.RegularExpressions;
using System.Windows.Input;
-using ActiproSoftware.Windows.Controls.SyntaxEditor.IntelliPrompt;
using Raven.Client.Linq;
using Raven.Studio.Commands;
using Raven.Studio.Features.Query;

0 comments on commit 18b520f

Please sign in to comment.