Skip to content

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

@aniket866

Description

@aniket866

Is there an existing issue for this?

  • 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

  • I agree to follow this project's Code of Conduct
  • I want to work on this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions