Skip to content

Commit 3ab5d3d

Browse files
Merge pull request #24 from TheCodeDaniel/fix/error_handling_issues
fix: error handling and UI adjustment, removed "flutter version manag…
2 parents 2fae0f2 + 1e7bcd7 commit 3ab5d3d

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

.vscode/settings.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"dart.lineLength": 120,
3-
"dart.flutterSdkPath": ".fvm/versions/3.27.1"
4-
}
2+
"dart.lineLength": 120
3+
}

lib/features/event_sockets/presentation/screens/event_sockets_view.dart

+7-3
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,19 @@ class _EventSocketsViewState extends State<EventSocketsView> {
126126
Icon(Iconsax.warning_2, color: Colors.amber),
127127
Text(
128128
"Check your socket parameters before connecting to websocket",
129-
style: TextStyle(fontStyle: FontStyle.italic, fontWeight: FontWeight.bold),
129+
style: TextStyle(fontWeight: FontWeight.bold),
130130
),
131131
],
132132
),
133133
Container(
134134
width: size.width * 0.4,
135-
height: size.height * 0.2,
135+
height: size.height * 0.3,
136136
padding: EdgeInsets.symmetric(horizontal: 20),
137-
color: Colors.grey.shade200,
137+
decoration: BoxDecoration(
138+
color: Colors.grey.shade300,
139+
borderRadius: BorderRadius.circular(10),
140+
border: Border.all(color: Colors.grey.shade400),
141+
),
138142
child: JsonEditorTheme(
139143
themeData: JsonEditorThemeData(lightTheme: JsonTheme.light()),
140144
child: JsonEditor.object(

lib/features/wsprotocol/data/repository/wsprotocol_repo_impl.dart

+8-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ class WsprotocolRepoImpl {
2626
},
2727
onError: (error) {
2828
// Forward errors to listeners.
29-
_messageController.addError(error);
29+
// _messageController.addError(error);
30+
// Extract error message
31+
final String errorMessage = error is WebSocketChannelException
32+
? 'WebSocket Error: ${error.inner}'
33+
: 'Unknown WebSocket Error: $error';
34+
35+
// Forward a structured error message
36+
_messageController.addError(errorMessage);
3037
},
3138
onDone: () {
3239
// Optionally notify listeners that the connection has closed.

0 commit comments

Comments
 (0)