mediaSfuConnectionError function
Implementation
String mediaSfuConnectionError(Object error, {required String action}) {
final message = error.toString().toLowerCase();
if (message.contains('timeout')) {
return 'The MediaSFU backend timed out while trying to $action. Please try again.';
}
if (message.contains('clientexception') ||
message.contains('failed host lookup') ||
message.contains('connection refused') ||
message.contains('connection reset') ||
message.contains('networkerror') ||
message.contains('xmlhttprequest error') ||
message.contains('failed to fetch') ||
message.contains('socketexception')) {
return 'Could not connect to the MediaSFU backend. Check your connection and configured backend URL.';
}
return 'The MediaSFU backend request failed while trying to $action. Please try again.';
}