From 014d86663d82432b413ef2e734f7a0c086bd3473 Mon Sep 17 00:00:00 2001 From: Victor Uvarov Date: Mon, 2 Dec 2024 08:51:46 -0800 Subject: [PATCH] use rethrow when possible --- analysis_options.yaml | 1 - lib/src/config.dart | 2 +- lib/src/rtc_session.dart | 4 ++-- lib/src/transports/tcp_socket.dart | 2 +- lib/src/transports/web_socket.dart | 2 +- lib/src/transports/websocket_dart_impl.dart | 2 +- lib/src/ua.dart | 4 ++-- 7 files changed, 8 insertions(+), 9 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 3a1f08c9..9b708ede 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -53,7 +53,6 @@ analyzer: avoid_types_as_parameter_names: ignore empty_catches: ignore unawaited_futures: ignore - use_rethrow_when_possible: ignore unused_import: ignore must_be_immutable: ignore todo: ignore diff --git a/lib/src/config.dart b/lib/src/config.dart index 4ece468f..102e7ef5 100644 --- a/lib/src/config.dart +++ b/lib/src/config.dart @@ -286,6 +286,6 @@ void load(Settings src, Settings? dst) { }); } catch (e) { logger.e('Failed to load config: ${e.toString()}'); - throw e; + rethrow; } } diff --git a/lib/src/rtc_session.dart b/lib/src/rtc_session.dart index 26e2dc33..b8dfa379 100644 --- a/lib/src/rtc_session.dart +++ b/lib/src/rtc_session.dart @@ -2354,7 +2354,7 @@ class RTCSession extends EventManager implements Owner { 'User Denied Media Access'); logger.e('emit "getusermediafailed" [error:${error.toString()}]'); emit(EventGetUserMediaFailed(exception: error)); - throw error; + rethrow; } } @@ -2406,7 +2406,7 @@ class RTCSession extends EventManager implements Owner { return; } logger.e('Failed to _sendInitialRequest: ${error.toString()}'); - throw error; + rethrow; } } diff --git a/lib/src/transports/tcp_socket.dart b/lib/src/transports/tcp_socket.dart index 85aa9ecc..ce3832c7 100644 --- a/lib/src/transports/tcp_socket.dart +++ b/lib/src/transports/tcp_socket.dart @@ -140,7 +140,7 @@ class SIPUATcpSocket extends SIPUASocketInterface { return true; } catch (error) { logger.e('send() | error sending message: $error'); - throw error; + rethrow; } } diff --git a/lib/src/transports/web_socket.dart b/lib/src/transports/web_socket.dart index 66123a00..57d610c8 100644 --- a/lib/src/transports/web_socket.dart +++ b/lib/src/transports/web_socket.dart @@ -142,7 +142,7 @@ class SIPUAWebSocket extends SIPUASocketInterface { return true; } catch (error) { logger.e('send() | error sending message: $error'); - throw error; + rethrow; } } diff --git a/lib/src/transports/websocket_dart_impl.dart b/lib/src/transports/websocket_dart_impl.dart index 6516515c..1ec30b21 100644 --- a/lib/src/transports/websocket_dart_impl.dart +++ b/lib/src/transports/websocket_dart_impl.dart @@ -118,7 +118,7 @@ class SIPUAWebSocketImpl { return webSocket; } catch (e) { logger.e('error $e'); - throw e; + rethrow; } } } diff --git a/lib/src/ua.dart b/lib/src/ua.dart index 92e581bb..6d0ed965 100644 --- a/lib/src/ua.dart +++ b/lib/src/ua.dart @@ -95,7 +95,7 @@ class UA extends EventManager { } catch (e) { _status = C.STATUS_NOT_READY; _error = C.CONFIGURATION_ERROR; - throw e; + rethrow; } // Initialize registrator. @@ -821,7 +821,7 @@ class UA extends EventManager { try { config.load(configuration, _configuration); } catch (e) { - throw e; + rethrow; } // Post Configuration Process.