summaryrefslogtreecommitdiff
path: root/lib/services/storegear_api_service.dart
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2023-06-09 21:38:29 +0200
committerAldrik Ramaekers <aldrik@amftech.nl>2023-06-09 21:38:29 +0200
commit629db8d6250bfbab82508e3ab1f083c0e38f605b (patch)
tree3645b1c2c64d70cbf44167e2456300ea946a0bc9 /lib/services/storegear_api_service.dart
parent97e0c8cef73064d121dcb38ab904e8d5d8ba5cdd (diff)
debug logging
Diffstat (limited to 'lib/services/storegear_api_service.dart')
-rw-r--r--lib/services/storegear_api_service.dart5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/services/storegear_api_service.dart b/lib/services/storegear_api_service.dart
index 3063b26..0c2cbbc 100644
--- a/lib/services/storegear_api_service.dart
+++ b/lib/services/storegear_api_service.dart
@@ -2,10 +2,12 @@ import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:http/http.dart' as http;
import 'package:training_planner/config/defaults.dart';
+import 'package:training_planner/main.dart';
import 'package:training_planner/models/login_request.dart';
import 'package:training_planner/models/login_response.dart';
import 'package:training_planner/models/route_list.dart';
import 'package:training_planner/route.dart';
+import 'package:training_planner/services/backup_helper_service.dart';
import 'package:training_planner/services/istoregear_api_service.dart';
import 'package:training_planner/route.dart' as DHLRoute;
import 'package:training_planner/services/mock_route_provider_service.dart';
@@ -33,6 +35,7 @@ class StoregearApiService extends IStoregearApiService {
return res;
} else {
print(response.body);
+ backupService.writeStringToFile(response.body, 'failed_login.txt');
// If the server did not return a 200 OK response,
// then throw an exception.
throw Exception('Failed login');
@@ -65,6 +68,7 @@ class StoregearApiService extends IStoregearApiService {
}
return RouteList.fromJson(content);
} else {
+ backupService.writeStringToFile(response.body, 'failed_routelist.txt');
// If the server did not return a 200 OK response,
// then throw an exception.
throw Exception('Failed to load routes');
@@ -92,6 +96,7 @@ class StoregearApiService extends IStoregearApiService {
}
return RouteInfo.fromJson(content).route;
} else {
+ backupService.writeStringToFile(response.body, 'failed_route.txt');
// If the server did not return a 200 OK response,
// then throw an exception.
throw Exception('Failed to load route');