diff --git a/lib/utils/error_reporter.dart b/lib/utils/error_reporter.dart index 6a8b0f866..a688ed003 100644 --- a/lib/utils/error_reporter.dart +++ b/lib/utils/error_reporter.dart @@ -5,7 +5,6 @@ import 'package:flutter/services.dart'; import 'package:flutter_highlighter/flutter_highlighter.dart'; import 'package:flutter_highlighter/themes/shades-of-purple.dart'; -import 'package:http/http.dart' as http; import 'package:matrix/matrix.dart'; import 'package:path/path.dart' as path; import 'package:path_provider/path_provider.dart'; @@ -21,12 +20,12 @@ class ErrorReporter { const ErrorReporter(this.context, [this.message]); - static const Set ingoredTypes = { - IOException, - http.ClientException, - SocketException, - TlsException, - HandshakeException, + static const Set ingoredTypes = { + "IOException", + "ClientException", + "SocketException", + "TlsException", + "HandshakeException", }; Future _getTemporaryErrorLogFile() async { @@ -38,7 +37,7 @@ class ErrorReporter { Object error, [ StackTrace? stackTrace, ]) async { - if (ingoredTypes.contains(error.runtimeType)) return; + if (ingoredTypes.contains(error.runtimeType.toString())) return; final file = await _getTemporaryErrorLogFile(); if (await file.exists()) await file.delete(); await file.writeAsString( @@ -55,7 +54,7 @@ class ErrorReporter { } void onErrorCallback(Object error, [StackTrace? stackTrace]) { - if (ingoredTypes.contains(error.runtimeType)) return; + if (ingoredTypes.contains(error.runtimeType.toString())) return; Logs().e(message ?? 'Error caught', error, stackTrace); final text = '$error\n${stackTrace ?? ''}'; return _onErrorCallback(text);