handleError static method
Implementation
static Future<void> handleError(Object e) async {
if (e is DioException) {
debugPrint('π΄ π΄ π΄ π΄ DioException caught! π΄ π΄ π΄ π΄ ');
debugPrint('Request Path: ${e.requestOptions.path}');
debugPrint('Type: ${e.type}');
debugPrint('Status Code: ${e.response?.statusCode}');
debugPrint('Data: ${e.response?.data}');
debugPrint('Message: ${e.message}');
debugPrint('π΄ π΄ π΄ π΄ π΄ π΄ π΄ π΄ ');
return;
} else {
String? user = await UFUtils.preferences.readObject(UFUtils.preferences.userData);
Map<String, dynamic>? userJson = user != null ? jsonDecode(user) : null;
List<String> information = [];
information.add("user_id: ${userJson?['_id']?.toString()}");
information.add("screen: ${Get.currentRoute}");
information.add("app_version: ${UFUtils.appVersion}");
FirebaseCrashlytics.instance.recordError(
e,
StackTrace.current,
fatal: false,
information: information
);
return;
}
}