fromResponse static method

Future<COSException> fromResponse(
  1. HttpClientResponse? res
)

Implementation

static Future<COSException> fromResponse(HttpClientResponse? res) async {
  try {
    final body = await res?.transform(utf8.decoder).join();
    final status = res?.statusCode;

    return COSException(message: 'statusCode: $status\n\n$body');
  } catch (e) {
    return COSException(message: 'unknown exception: $e');
  }
}