Skip to content

Handle Errors #1

@phabos

Description

@phabos

Hello Loredana,

Just went through your great article on medium.
I do not know if i'm in the right place to ask my question... Anyway :
I was experimenting your code, and i do not figure out how to handle the errors, for instance if the api is not answering.
I assume we throw the exeption throw Exception('Failed to load weather');.

But how do we catch the exception in order to display an error message in the UI for instance. I thought, I was able to get it via snapshot.hasError, but it does not seem to be that way...

Thank you !

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