EdsonBueno / infinite_scroll_pagination

Flutter package to help you lazily load and display pages of items as the user scrolls down your screen.
https://pub.dev/packages/infinite_scroll_pagination
MIT License
612 stars 202 forks source link

Pass exception and stacktrace to error builders #280

Closed itsJoKr closed 11 months ago

itsJoKr commented 11 months ago

We should show a different message depending on the error that happened. For example, if the user has no internet "no internet connection", but if the server throws 500 then we want "server error occurred" or a similar way for other errors.

With the current setup, there is no way to differentiate what happened and show an appropriate error message. The try/catch happens inside this package and all the information about exception or stack trace is lost.

Proposition is to change from:

     firstPageErrorIndicatorBuilder: (context) => IDontKnowWhichErrorHappened(),

to

     firstPageErrorIndicatorBuilder: (context, error, stacktrace) => NowIKnowAndCanHanleIt(error, stacktrace),
itsJoKr commented 11 months ago

My mistake there is actually a way to read errors, although I little bit clunky

firstPageErrorIndicatorBuilder : (context) => MyErrorWidget(pagingController.error, context),