Throw exception for failed requests

dashboard
Pat Hartl 2023-01-05 18:35:58 -06:00
parent 8e2fe00004
commit 13c57729d8
1 changed files with 12 additions and 1 deletions

View File

@ -38,7 +38,18 @@ namespace LANCommander.Playnite.Extension
Password = password
}));
switch (response.StatusCode)
{
case HttpStatusCode.OK:
return response.Data;
case HttpStatusCode.Forbidden:
case HttpStatusCode.BadRequest:
throw new WebException("Invalid username or password");
default:
throw new WebException("Could not communicate with the server");
}
}
public AuthResponse RefreshToken(AuthToken token)