mirror of
https://github.com/bitwarden/android.git
synced 2024-12-21 00:31:58 +03:00
Handle all exceptions from API calls
This commit is contained in:
parent
d112e0ea42
commit
749508871b
7 changed files with 16 additions and 16 deletions
|
@ -44,7 +44,7 @@ namespace Bit.App.Repositories
|
||||||
|
|
||||||
return ApiResult.Success(response.StatusCode);
|
return ApiResult.Success(response.StatusCode);
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return HandledWebException();
|
return HandledWebException();
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ namespace Bit.App.Repositories
|
||||||
|
|
||||||
return ApiResult.Success(response.StatusCode);
|
return ApiResult.Success(response.StatusCode);
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return HandledWebException();
|
return HandledWebException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ namespace Bit.App.Repositories
|
||||||
var responseObj = JsonConvert.DeserializeObject<TResponse>(responseContent);
|
var responseObj = JsonConvert.DeserializeObject<TResponse>(responseContent);
|
||||||
return ApiResult<TResponse>.Success(responseObj, response.StatusCode);
|
return ApiResult<TResponse>.Success(responseObj, response.StatusCode);
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return HandledWebException<TResponse>();
|
return HandledWebException<TResponse>();
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ namespace Bit.App.Repositories
|
||||||
var responseObj = JsonConvert.DeserializeObject<ListResponse<TResponse>>(responseContent);
|
var responseObj = JsonConvert.DeserializeObject<ListResponse<TResponse>>(responseContent);
|
||||||
return ApiResult<ListResponse<TResponse>>.Success(responseObj, response.StatusCode);
|
return ApiResult<ListResponse<TResponse>>.Success(responseObj, response.StatusCode);
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return HandledWebException<ListResponse<TResponse>>();
|
return HandledWebException<ListResponse<TResponse>>();
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ namespace Bit.App.Repositories
|
||||||
var responseObj = JsonConvert.DeserializeObject<TResponse>(responseContent);
|
var responseObj = JsonConvert.DeserializeObject<TResponse>(responseContent);
|
||||||
return ApiResult<TResponse>.Success(responseObj, response.StatusCode);
|
return ApiResult<TResponse>.Success(responseObj, response.StatusCode);
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return HandledWebException<TResponse>();
|
return HandledWebException<TResponse>();
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ namespace Bit.App.Repositories
|
||||||
var responseObj = JsonConvert.DeserializeObject<TResponse>(responseContent);
|
var responseObj = JsonConvert.DeserializeObject<TResponse>(responseContent);
|
||||||
return ApiResult<TResponse>.Success(responseObj, response.StatusCode);
|
return ApiResult<TResponse>.Success(responseObj, response.StatusCode);
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return HandledWebException<TResponse>();
|
return HandledWebException<TResponse>();
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ namespace Bit.App.Repositories
|
||||||
|
|
||||||
return ApiResult.Success(response.StatusCode);
|
return ApiResult.Success(response.StatusCode);
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return HandledWebException();
|
return HandledWebException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace Bit.App.Repositories
|
||||||
TokenService.RefreshToken = tokenResponse.RefreshToken;
|
TokenService.RefreshToken = tokenResponse.RefreshToken;
|
||||||
TokenService.AuthBearer = null;
|
TokenService.AuthBearer = null;
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return webException.Invoke();
|
return webException.Invoke();
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ namespace Bit.App.Repositories
|
||||||
TokenService.Token = tokenResponse.AccessToken;
|
TokenService.Token = tokenResponse.AccessToken;
|
||||||
TokenService.RefreshToken = tokenResponse.RefreshToken;
|
TokenService.RefreshToken = tokenResponse.RefreshToken;
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return webException.Invoke();
|
return webException.Invoke();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace Bit.App.Repositories
|
||||||
var responseObj = JsonConvert.DeserializeObject<CipherResponse>(responseContent);
|
var responseObj = JsonConvert.DeserializeObject<CipherResponse>(responseContent);
|
||||||
return ApiResult<CipherResponse>.Success(responseObj, response.StatusCode);
|
return ApiResult<CipherResponse>.Success(responseObj, response.StatusCode);
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return HandledWebException<CipherResponse>();
|
return HandledWebException<CipherResponse>();
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ namespace Bit.App.Repositories
|
||||||
var responseObj = JsonConvert.DeserializeObject<ListResponse<CipherResponse>>(responseContent);
|
var responseObj = JsonConvert.DeserializeObject<ListResponse<CipherResponse>>(responseContent);
|
||||||
return ApiResult<ListResponse<CipherResponse>>.Success(responseObj, response.StatusCode);
|
return ApiResult<ListResponse<CipherResponse>>.Success(responseObj, response.StatusCode);
|
||||||
}
|
}
|
||||||
catch(WebException e)
|
catch
|
||||||
{
|
{
|
||||||
return HandledWebException<ListResponse<CipherResponse>>();
|
return HandledWebException<ListResponse<CipherResponse>>();
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ namespace Bit.App.Repositories
|
||||||
var responseObj = JsonConvert.DeserializeObject<CipherHistoryResponse>(responseContent);
|
var responseObj = JsonConvert.DeserializeObject<CipherHistoryResponse>(responseContent);
|
||||||
return ApiResult<CipherHistoryResponse>.Success(responseObj, response.StatusCode);
|
return ApiResult<CipherHistoryResponse>.Success(responseObj, response.StatusCode);
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return HandledWebException<CipherHistoryResponse>();
|
return HandledWebException<CipherHistoryResponse>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace Bit.App.Repositories
|
||||||
var responseObj = JsonConvert.DeserializeObject<TokenResponse>(responseContent);
|
var responseObj = JsonConvert.DeserializeObject<TokenResponse>(responseContent);
|
||||||
return ApiResult<TokenResponse>.Success(responseObj, response.StatusCode);
|
return ApiResult<TokenResponse>.Success(responseObj, response.StatusCode);
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return HandledWebException<TokenResponse>();
|
return HandledWebException<TokenResponse>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace Bit.App.Repositories
|
||||||
|
|
||||||
return ApiResult.Success(response.StatusCode);
|
return ApiResult.Success(response.StatusCode);
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return HandledWebException();
|
return HandledWebException();
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ namespace Bit.App.Repositories
|
||||||
|
|
||||||
return ApiResult.Success(response.StatusCode);
|
return ApiResult.Success(response.StatusCode);
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return HandledWebException();
|
return HandledWebException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace Bit.App.Repositories
|
||||||
var responseObj = JsonConvert.DeserializeObject<ListResponse<FolderResponse>>(responseContent);
|
var responseObj = JsonConvert.DeserializeObject<ListResponse<FolderResponse>>(responseContent);
|
||||||
return ApiResult<ListResponse<FolderResponse>>.Success(responseObj, response.StatusCode);
|
return ApiResult<ListResponse<FolderResponse>>.Success(responseObj, response.StatusCode);
|
||||||
}
|
}
|
||||||
catch(WebException)
|
catch
|
||||||
{
|
{
|
||||||
return HandledWebException<ListResponse<FolderResponse>>();
|
return HandledWebException<ListResponse<FolderResponse>>();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue