From fa31e287abfed59269385486c48599c9d66b8d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Mielcarek?= Date: Wed, 30 Nov 2022 07:50:30 +0100 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration=20de=20l'exception=20Http?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/exceptions/http_exception.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Sources/dafl_project_flutter/lib/exceptions/http_exception.dart b/Sources/dafl_project_flutter/lib/exceptions/http_exception.dart index f2f6888..bdcc0e6 100644 --- a/Sources/dafl_project_flutter/lib/exceptions/http_exception.dart +++ b/Sources/dafl_project_flutter/lib/exceptions/http_exception.dart @@ -1,9 +1,12 @@ import 'dart:developer' as dev; +import 'package:http/http.dart'; class HttpException implements Exception { HttpException(var value) { - dev.log('Http request failed :'); - dev.log('Status code : ${value.statusCode.toString()}'); - dev.log('Body : ${value.body.toString()}'); + dev.log('Http request failed'); + if (value.runtimeType == Response) { + dev.log('Status code : ${value.statusCode.toString()}'); + dev.log('Body : ${value.body.toString()}'); + } } -} +} \ No newline at end of file