Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_commit throws: Invalid value: Not in inclusive range #66

Closed
Cotspheer opened this issue Mar 12, 2023 · 1 comment
Closed

_commit throws: Invalid value: Not in inclusive range #66

Cotspheer opened this issue Mar 12, 2023 · 1 comment

Comments

@Cotspheer
Copy link

I encounter an error when I get an HTTP error where no \n is present.

flutter: RangeError (end): Invalid value: Not in inclusive range 0..154: -1;#0      RangeError.checkValidRange (dart:core/errors.dart:379:9)
flutter: #1      _StringBase.substring (dart:core-patch/string_patch.dart:398:27)
flutter: #2      LoggyDioInterceptor._commit
dio_logger.dart:174
flutter: #3      LoggyDioInterceptor.onError
dio_logger.dart:97
flutter: #4      DioMixin.fetch.errorInterceptorWrapper.<anonymous closure>.<anonymous closure>
dio_mixin.dart:463
flutter: #5      new Future.<anonymous closure> (dart:async/future.dart:253:37)
flutter: #6      _rootRun (dart:async/zone.dart:1390:47)
flutter: #7      _CustomZone.run (dart:async/zone.dart:1300:19)
flutter: #8      _CustomZone.runGuarded (dart:async/zone.dart:1208:7)
flutter: #9      _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1248:23)
flutter: #10     _rootRun (dart:async/zone.dart:1398:13)
flutter: #11     _CustomZone.run (dart:async/zone.dart:1300:19)
flutter: #12     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1232:23)
flutter: #13     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
flutter: #14     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
flutter: #15     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
flutter: #16     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26)

Issue is the line 174 in LoggyDioInterceptor (dio_logger.dart):

final String errorTitle = valueError.substring(0, valueError.indexOf('\n'));

When valueError.indexOf returns -1 it results in an error.

valueError => "<<< DioError │ GET │ 401 Unauthorized │ https://redacted.azurecontainerapps.io/api/v1/some/apiEndpoint"

Would be great to have this checked and fixed as it crashes dio.

@itsJoKr
Copy link
Contributor

itsJoKr commented Mar 17, 2023

Should be fixed in flutter_loggy_dio: ^3.0.1

@itsJoKr itsJoKr closed this as completed Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants