responseValidOrThrow function
void
responseValidOrThrow(
- Response res
If status
code is an exception it will throw a PubClientException
Implementation
void responseValidOrThrow(Response res) {
final status = res.statusCode;
// Sucessful request
if (status >= 200 && status < 400) {
return;
}
switch (status) {
case HttpStatus.forbidden:
throw ForbiddenException(res);
case HttpStatus.notFound:
throw NotFoundException(res);
case HttpStatus.unauthorized:
throw UnauthorizedException(res);
case HttpStatus.badRequest:
throw BadRequestException(res);
case HttpStatus.internalServerError:
throw InternalServerError(res);
default:
throw UnknownException(res);
}
}