AOSSIE-Org / AOSSIE-Org/Ell-ena

BUG:Unsafe JSON Decoding->the API returns a 500 error (HTML body) or network error, the app will crash.

Offen
#153 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Dart
Sterne
54
Forks
110
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Is there an existing issue for this?

- [x] I have searched the existing issues

### What happened?

### Unsafe JSON Decoding

- **Where**: `AIService.generateChatResponse`

- **Issue**: jsonDecode(response.body) is called without a try-catch block. If the API returns a 500 error (HTML body) or network error, the app will crash.

- **Fix**: Check response.statusCode before decoding and use try-catch.

- **why**?If the API returns a 500 error (HTML body) or network error, the app will crash.

@SharkyBytes Please checkout the fix here

### Record

- [x] I agree to follow this project's Code of Conduct
- [x] I want to work on this issue

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.