mirror of
https://github.com/bitwarden/mobile
synced 2025-12-18 01:03:24 +00:00
Show exception message from Api errors
This commit is contained in:
@@ -97,9 +97,9 @@ namespace Bit.Core.Services
|
|||||||
{
|
{
|
||||||
response = await _httpClient.SendAsync(requestMessage);
|
response = await _httpClient.SendAsync(requestMessage);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new ApiException(HandleWebError());
|
throw new ApiException(HandleWebError(e));
|
||||||
}
|
}
|
||||||
JObject responseJObject = null;
|
JObject responseJObject = null;
|
||||||
if(IsJsonResponse(response))
|
if(IsJsonResponse(response))
|
||||||
@@ -318,9 +318,9 @@ namespace Bit.Core.Services
|
|||||||
{
|
{
|
||||||
response = await _httpClient.SendAsync(requestMessage);
|
response = await _httpClient.SendAsync(requestMessage);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new ApiException(HandleWebError());
|
throw new ApiException(HandleWebError(e));
|
||||||
}
|
}
|
||||||
if(!response.IsSuccessStatusCode)
|
if(!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
@@ -397,9 +397,9 @@ namespace Bit.Core.Services
|
|||||||
{
|
{
|
||||||
response = await _httpClient.SendAsync(requestMessage);
|
response = await _httpClient.SendAsync(requestMessage);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new ApiException(HandleWebError());
|
throw new ApiException(HandleWebError(e));
|
||||||
}
|
}
|
||||||
if(hasResponse && response.IsSuccessStatusCode)
|
if(hasResponse && response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
@@ -443,9 +443,9 @@ namespace Bit.Core.Services
|
|||||||
{
|
{
|
||||||
response = await _httpClient.SendAsync(requestMessage);
|
response = await _httpClient.SendAsync(requestMessage);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new ApiException(HandleWebError());
|
throw new ApiException(HandleWebError(e));
|
||||||
}
|
}
|
||||||
if(response.IsSuccessStatusCode)
|
if(response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
@@ -461,12 +461,12 @@ namespace Bit.Core.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ErrorResponse HandleWebError()
|
private ErrorResponse HandleWebError(Exception e)
|
||||||
{
|
{
|
||||||
return new ErrorResponse
|
return new ErrorResponse
|
||||||
{
|
{
|
||||||
StatusCode = HttpStatusCode.BadGateway,
|
StatusCode = HttpStatusCode.BadGateway,
|
||||||
Message = "There is a problem connecting to the server."
|
Message = "Exception message: " + e.Message
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user