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.

Open
#153 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
54
Forks
110
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.