private void OnListFailed(DropboxException ex) { Dispatcher.BeginInvoke(() => MessageBox.Show( DropBoxResources.ListError, DropBoxResources.ListTitle, MessageBoxButton.OK)); }
private void ShowError(DropboxException dropboxException) { Dispatcher.BeginInvoke(() => MessageBox.Show( DropBoxResources.GetTokenError, "DropBox", MessageBoxButton.OK)); }
public void LogException(DropboxException exception) { if ((exception is DropboxRestException) && ((DropboxRestException)exception).StatusCode == HttpStatusCode.Unauthorized) { return; } Logger.LogExceptionSilently(exception); }
private void OnChunkedUploadFailure(DropboxException dropboxException) { _chunksFailed++; if (_lastChunkUploaded != null && _chunksFailed <= _maxRetries.GetValueOrDefault(DefaultMaxRetries)) { OnChunkSuccess(_lastChunkUploaded); } else { _failure.Invoke(dropboxException); } }
public void LogException(DropboxException exception) { switch (exception.StatusCode) { case HttpStatusCode.Unauthorized: break; default: myLogger.LogExceptionSilently(exception); break; } }
private void Fail(DropboxException ex) { Found = false; IsLoading = false; if (ex.StatusCode == HttpStatusCode.NotFound) { MessageBox.Show(Labels.ConnectionErrorMessage, Labels.ConnectionErrorTitle, MessageBoxButton.OK); } MessageBox.Show(Labels.GenericErrorMessage, Labels.ErrorTitle, MessageBoxButton.OK); }
private void OnFileDownloadFailed(DropboxException obj) { Dispatcher.BeginInvoke(() => { progBusy.IsBusy = false; MessageBox.Show( DropBoxResources.DownloadError, DropBoxResources.ListTitle, MessageBoxButton.OK); }); }
public static ExitCode?HandleBadInputException(this DropboxException ex) { var badInputException = ex as BadInputException; if (badInputException == null) { return(null); } Console.WriteLine($"An error occurred: {badInputException}"); return(ExitCode.BadArguments); }
public static ExitCode?HandleHttpException(this DropboxException ex) { var httpException = ex as HttpException; if (httpException == null) { return(null); } Console.WriteLine($"An HTTP error occurred: {httpException}"); return(ExitCode.BadArguments); }
public static ExitCode?HandleAuthException(this DropboxException ex) { var authException = ex as AuthException; if (authException == null) { return(null); } Console.WriteLine($"An authentication error occurred: {authException}"); return(ExitCode.AccessDenied); }
public static ExitCode?HandleRateLimitException(this DropboxException ex) { var rateLimitException = ex as RateLimitException; if (rateLimitException == null) { return(null); } Console.WriteLine($"A rate limit error occurred: {rateLimitException}"); return(ExitCode.Canceled); }
void OnDownloadFailed(DropboxException ex) { Utilities.ShowProgressIndicator(false); switch (ex.StatusCode) { case HttpStatusCode.NotFound: MessageBox.Show(Labels.FileNotFoundShare, Labels.ErrorTitle, MessageBoxButton.OK); break; default: MessageBox.Show(ex.StatusCode.ToString()); break; } }
private static ExitCode HandleDropboxException(DropboxException ex) { Console.WriteLine("An error occurred and your file was not uploaded."); var exitCode = ex.HandleAuthException() ?? ex.HandleAccessException() ?? ex.HandleRateLimitException() ?? ex.HandleBadInputException() ?? ex.HandleHttpException() ?? ExitCode.UnknownError; if (exitCode == ExitCode.UnknownError) { Console.WriteLine(ex.Message); } return(exitCode); }
void OnFail(DropboxException ed) { Utilities.ShowProgressIndicator(false); Uploading = false; switch (ed.StatusCode) { case HttpStatusCode.NotFound: case HttpStatusCode.LengthRequired: MessageBox.Show(Labels.ConnectionErrorMessage, Labels.ConnectionErrorTitle, MessageBoxButton.OK); return; case HttpStatusCode.BadRequest: MessageBox.Show(Labels.FileExtensionError, Labels.ErrorTitle, MessageBoxButton.OK); return; } MessageBox.Show(Labels.GenericErrorMessage, Labels.ErrorTitle, MessageBoxButton.OK); }
private static ExitCode HandleException(DropboxException ex) { Console.WriteLine("An error occurred and your file was not uploaded."); Console.WriteLine(ex.StatusCode); Console.WriteLine(ex.Response); switch (ex.StatusCode) { case HttpStatusCode.Unauthorized: return(ExitCode.AccessDenied); case HttpStatusCode.Conflict: // Shouldn't happen with the DropNet defaults (overwrite = true), but just in case return(ExitCode.FileExists); } return(ExitCode.UnknownError); }
void Fail(DropboxException ed) { Utilities.ShowProgressIndicator(false); switch ((int)ed.StatusCode) { case (int)HttpStatusCode.NotFound: MessageBox.Show(Labels.ConnectionErrorMessage, Labels.ConnectionErrorTitle, MessageBoxButton.OK); return; case (int)HttpStatusCode.Forbidden: MessageBox.Show(Labels.FolderExist, Labels.ErrorTitle, MessageBoxButton.OK); return; case 507: MessageBox.Show(Labels.NoSpaceAvailable, Labels.ErrorTitle, MessageBoxButton.OK); return; } MessageBox.Show(ed.StatusCode.ToString()); }
void DeleteFailed(DropboxException ex) { Utilities.ShowProgressIndicator(false); switch (ex.StatusCode) { case HttpStatusCode.Forbidden: MessageBox.Show(Labels.DeleteFileError, Labels.ErrorTitle, MessageBoxButton.OK); return; case HttpStatusCode.NotFound: MessageBox.Show(Labels.FileNotFoundDelete, Labels.ErrorTitle, MessageBoxButton.OK); return; case HttpStatusCode.NotAcceptable: MessageBox.Show(Labels.ServerError, Labels.ErrorTitle, MessageBoxButton.OK); return; default: MessageBox.Show(ex.StatusCode.ToString()); break; } }
private void OnFail(DropboxException ex) { MessageBox.Show(Labels.UserInfoError, Labels.ErrorTitle, MessageBoxButton.OK); }
protected void Fail(DropboxException ed) { IsLoading = false; Deployment.Current.Dispatcher.BeginInvoke(() => Utilities.ShowProgressIndicator(false)); MessageBox.Show(Labels.GenericErrorMessage, Labels.ErrorTitle, MessageBoxButton.OK); }
private void Can_Get_Thumbnail_Async_Failure(DropboxException error) { Assert.IsTrue(false); }
private void Can_Upload_Large_File_Async_Failure(DropboxException error) { Assert.IsTrue(false); }
void OnFail(DropboxException obj) { Debug.WriteLine(obj.Message); }
// We could call GetMetadataASync() to check for file-not-found, but that'd be an extra network call. private static bool IsFileNotFoundException(DropboxException e) { return(e.Message == "path/not_found/"); }
/// <summary> /// DropboxException hides the true error in other properties /// </summary> private Exception CreateUsableExceptionFrom(DropboxException ex) { return(new Exception("Dropbox error " + ex.Response.ReasonPhrase + " (" + ex.StatusCode + ")", ex)); }