AOSSIE-Org / AOSSIE-Org/Resonate

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

オープン
#680 コメント 3 件 リアクション 0 件 担当者 1 名 @YadavAkhileshh が担当を希望しています GitHub で見る
enhancement good first issue
主要言語
Dart
スター
344
フォーク
350
PR マージ指標
30日以内にマージされた PR はありません

説明

## 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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。