AOSSIE-Org / AOSSIE-Org/Resonate

`refactor: Replace print() statement with proper logging in whisper_transcription_controller`

Abierto
#680 3 comentarios 0 reacciones 1 asignado Reclamado por @YadavAkhileshh Ver en GitHub
enhancement good first issue
Lenguaje dominante
Dart
Estrellas
344
Forks
350
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

## Description
The `whisper_transcription_controller.dart` file has two logging/error handling issues:
1. Line 71: Using `print()` instead of proper logging
2. Lines 62-73: Generic error handling without context or stack trace

## Current Issues

### Issue 1: Using print() instead of log()
```dart
} catch (e) {
print(e.toString());
}
```

### Issue 2: Poor error handling in loop (Lines 62-73)
```dart
for (WhisperTranscribeSegment? segment in transcriptionSegments) {
try {
final segmentString = _parseTranscriptionSegment(segment);
if (segmentString != null) {
lrcContent.writeln(segmentString);
}
} catch (e) {
print(e.toString()); // No context, no stack trace
}
}
```

## Problems
1. Using `print()` instead of `log()` (file already imports `dart:developer`)
2. Inconsistent logging (rest of file uses `log()`)
3. No context about which segment failed
4. No stack trace for debugging
5. Silently continues without proper error reporting

## Proposed Solution

### Fix 1: Replace print() with log()
```dart
} catch (e) {
log('Error converting transcription segment: ${e.toString()}');
}
```

### Fix 2: Improve error handling with context
```dart
for (int i = 0; i < transcriptionSegments.length; i++) {
try {
final segment = transcriptionSegments[i];
final segmentString = _parseTranscriptionSegment(segment);
if (segmentString != null) {
lrcContent.writeln(segmentString);
}
} catch (e, stackTrace) {
log(
'Error converting transcription segment at index $i: ${e.toString()}',
error: e,
stackTrace: stackTrace,
);
......
}
}
```

## Benefits
- Consistent logging throughout the file
- Better debugging with segment index
- Proper stack traces for error diagnosis
- Follows Flutter best practices
- More maintainable code

## Files to Change
- `lib/controllers/whisper_transcription_controller.dart` (2 locations)

## I would like to work on this

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.