Handle all exceptions from API calls

This commit is contained in:
Kyle Spearrin 2017-02-06 09:55:35 -05:00
parent d112e0ea42
commit 749508871b
7 changed files with 16 additions and 16 deletions

View file

@ -44,7 +44,7 @@ namespace Bit.App.Repositories
return ApiResult.Success(response.StatusCode);
}
catch(WebException)
catch
{
return HandledWebException();
}
@ -76,7 +76,7 @@ namespace Bit.App.Repositories
return ApiResult.Success(response.StatusCode);
}
catch(WebException)
catch
{
return HandledWebException();
}

View file

@ -55,7 +55,7 @@ namespace Bit.App.Repositories
var responseObj = JsonConvert.DeserializeObject<TResponse>(responseContent);
return ApiResult<TResponse>.Success(responseObj, response.StatusCode);
}
catch(WebException)
catch
{
return HandledWebException<TResponse>();
}
@ -95,7 +95,7 @@ namespace Bit.App.Repositories
var responseObj = JsonConvert.DeserializeObject<ListResponse<TResponse>>(responseContent);
return ApiResult<ListResponse<TResponse>>.Success(responseObj, response.StatusCode);
}
catch(WebException)
catch
{
return HandledWebException<ListResponse<TResponse>>();
}
@ -135,7 +135,7 @@ namespace Bit.App.Repositories
var responseObj = JsonConvert.DeserializeObject<TResponse>(responseContent);
return ApiResult<TResponse>.Success(responseObj, response.StatusCode);
}
catch(WebException)
catch
{
return HandledWebException<TResponse>();
}
@ -175,7 +175,7 @@ namespace Bit.App.Repositories
var responseObj = JsonConvert.DeserializeObject<TResponse>(responseContent);
return ApiResult<TResponse>.Success(responseObj, response.StatusCode);
}
catch(WebException)
catch
{
return HandledWebException<TResponse>();
}
@ -213,7 +213,7 @@ namespace Bit.App.Repositories
return ApiResult.Success(response.StatusCode);
}
catch(WebException)
catch
{
return HandledWebException();
}

View file

@ -84,7 +84,7 @@ namespace Bit.App.Repositories
TokenService.RefreshToken = tokenResponse.RefreshToken;
TokenService.AuthBearer = null;
}
catch(WebException)
catch
{
return webException.Invoke();
}
@ -119,7 +119,7 @@ namespace Bit.App.Repositories
TokenService.Token = tokenResponse.AccessToken;
TokenService.RefreshToken = tokenResponse.RefreshToken;
}
catch(WebException)
catch
{
return webException.Invoke();
}

View file

@ -54,7 +54,7 @@ namespace Bit.App.Repositories
var responseObj = JsonConvert.DeserializeObject<CipherResponse>(responseContent);
return ApiResult<CipherResponse>.Success(responseObj, response.StatusCode);
}
catch(WebException)
catch
{
return HandledWebException<CipherResponse>();
}
@ -94,7 +94,7 @@ namespace Bit.App.Repositories
var responseObj = JsonConvert.DeserializeObject<ListResponse<CipherResponse>>(responseContent);
return ApiResult<ListResponse<CipherResponse>>.Success(responseObj, response.StatusCode);
}
catch(WebException e)
catch
{
return HandledWebException<ListResponse<CipherResponse>>();
}
@ -134,7 +134,7 @@ namespace Bit.App.Repositories
var responseObj = JsonConvert.DeserializeObject<CipherHistoryResponse>(responseContent);
return ApiResult<CipherHistoryResponse>.Success(responseObj, response.StatusCode);
}
catch(WebException)
catch
{
return HandledWebException<CipherHistoryResponse>();
}

View file

@ -60,7 +60,7 @@ namespace Bit.App.Repositories
var responseObj = JsonConvert.DeserializeObject<TokenResponse>(responseContent);
return ApiResult<TokenResponse>.Success(responseObj, response.StatusCode);
}
catch(WebException)
catch
{
return HandledWebException<TokenResponse>();
}

View file

@ -51,7 +51,7 @@ namespace Bit.App.Repositories
return ApiResult.Success(response.StatusCode);
}
catch(WebException)
catch
{
return HandledWebException();
}
@ -84,7 +84,7 @@ namespace Bit.App.Repositories
return ApiResult.Success(response.StatusCode);
}
catch(WebException)
catch
{
return HandledWebException();
}

View file

@ -54,7 +54,7 @@ namespace Bit.App.Repositories
var responseObj = JsonConvert.DeserializeObject<ListResponse<FolderResponse>>(responseContent);
return ApiResult<ListResponse<FolderResponse>>.Success(responseObj, response.StatusCode);
}
catch(WebException)
catch
{
return HandledWebException<ListResponse<FolderResponse>>();
}