mirror of
https://github.com/bitwarden/android.git
synced 2025-01-11 18:57:39 +03:00
Show exception message from Api errors
This commit is contained in:
parent
ac7e90c0aa
commit
55f160d125
1 changed files with 10 additions and 10 deletions
|
@ -97,9 +97,9 @@ namespace Bit.Core.Services
|
|||
{
|
||||
response = await _httpClient.SendAsync(requestMessage);
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ApiException(HandleWebError());
|
||||
throw new ApiException(HandleWebError(e));
|
||||
}
|
||||
JObject responseJObject = null;
|
||||
if(IsJsonResponse(response))
|
||||
|
@ -318,9 +318,9 @@ namespace Bit.Core.Services
|
|||
{
|
||||
response = await _httpClient.SendAsync(requestMessage);
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ApiException(HandleWebError());
|
||||
throw new ApiException(HandleWebError(e));
|
||||
}
|
||||
if(!response.IsSuccessStatusCode)
|
||||
{
|
||||
|
@ -397,9 +397,9 @@ namespace Bit.Core.Services
|
|||
{
|
||||
response = await _httpClient.SendAsync(requestMessage);
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ApiException(HandleWebError());
|
||||
throw new ApiException(HandleWebError(e));
|
||||
}
|
||||
if(hasResponse && response.IsSuccessStatusCode)
|
||||
{
|
||||
|
@ -443,9 +443,9 @@ namespace Bit.Core.Services
|
|||
{
|
||||
response = await _httpClient.SendAsync(requestMessage);
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ApiException(HandleWebError());
|
||||
throw new ApiException(HandleWebError(e));
|
||||
}
|
||||
if(response.IsSuccessStatusCode)
|
||||
{
|
||||
|
@ -461,12 +461,12 @@ namespace Bit.Core.Services
|
|||
}
|
||||
}
|
||||
|
||||
private ErrorResponse HandleWebError()
|
||||
private ErrorResponse HandleWebError(Exception e)
|
||||
{
|
||||
return new ErrorResponse
|
||||
{
|
||||
StatusCode = HttpStatusCode.BadGateway,
|
||||
Message = "There is a problem connecting to the server."
|
||||
Message = "Exception message: " + e.Message
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue