简体   繁体   English

Flutter:DioError [DioErrorType.RESPONSE]:Http 状态错误 [500]

[英]Flutter: DioError [DioErrorType.RESPONSE]: Http status error [500]

I was asked to resolve some problems in flutter app Now I face problem I don't know what reason to...我被要求解决颤振应用程序中的一些问题现在我遇到问题我不知道为什么要...

The app start with signup page, when the user create new account the app send verification mail via Firebase该应用程序从注册页面开始,当用户创建新帐户时,该应用程序通过 Firebase 发送验证邮件

The situation is: when I try to signup new account, or login to any account The app keep loading and no verification mail send and in log I face the error情况是:当我尝试注册新帐户或登录任何帐户时,应用程序不断加载,没有发送验证邮件,登录时遇到错误

DioError [DioErrorType.RESPONSE]: Http status error [500] DioError [DioErrorType.RESPONSE]:Http 状态错误 [500]

Through my research on the problem, I know that the cause is: The sever responded with InternalServerError but dio sees this as an exception but I'm not sure, what shall I do to fix this error通过我对问题的研究,我知道原因是:服务器以InternalServerError响应,但 dio 认为这是一个异常,但我不确定,我应该如何解决这个错误

So, I need help所以,我需要帮助

here the log这里是日志

I/flutter (30836): ╔╣ Request ║ POST 
I/flutter (30836): ║  https://myBackendDomain.com/carRent/api/index.php/auth/send_email_to_user
I/flutter (30836): ╚══════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter (30836): ╔ Headers 
I/flutter (30836): ╟ content-type: application/json; charset=utf-8
I/flutter (30836): ╟ contentType: application/json; charset=utf-8
I/flutter (30836): ╟ followRedirects: true
I/flutter (30836): ╟ connectTimeout: 60000
I/flutter (30836): ╟ receiveTimeout: 60000
I/flutter (30836): ╚══════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter (30836): ╔ Body 
I/flutter (30836): ╟ emailto: abc@abc.com
I/flutter (30836): ╟ text: Your Email verification OTP is 690139
I/flutter (30836): ╟ subject: Verification
I/flutter (30836): ╚══════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter (30836): ║ {emailto: abc@abc.com, text: Your Email verification OTP is 690139, subject: Verification}
I/flutter (30836): 
I/flutter (30836): ╔╣ Request ║ POST 
I/flutter (30836): ║  https://myBackendDomain.com/carRent/api/index.php/auth/send_email_to_user
I/flutter (30836): ╚══════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter (30836): ╔ Headers 
I/flutter (30836): ╟ content-type: application/json; charset=utf-8
I/flutter (30836): ╟ Client-Service: frontend-client
I/flutter (30836): ╟ Auth-Key: simplerestapi
I/flutter (30836): ╟ contentType: application/json; charset=utf-8
I/flutter (30836): ╟ responseType: ResponseType.json
I/flutter (30836): ╟ followRedirects: true
I/flutter (30836): ╟ connectTimeout: 60000
I/flutter (30836): ╟ receiveTimeout: 60000
I/flutter (30836): ╚══════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter (30836): ╔ Body 
I/flutter (30836): ╟ emailto: abc@abc.com
I/flutter (30836): ╟ text: Your Email verification OTP is 690139
I/flutter (30836): ╟ subject: rentors
I/flutter (30836): ╚══════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter (30836): ║ {emailto: abc@abc.com, text: Your Email verification OTP is 690139, subject: Verification}
I/flutter (30836): 
I/flutter (30836): ╔╣ DioError ║ Status: 500 Internal Server Error
I/flutter (30836): ║  https://myBackendDomain.com/carRent/api/index.php/auth/send_email_to_user
I/flutter (30836): ╚══════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter (30836): ╔ DioErrorType.response
I/flutter (30836): ╚══════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter (30836): 
I/flutter (30836): DioError [DioErrorType.response]: Http status error [500]
I/flutter (30836): 
I/flutter (30836): ╔╣ DioError ║ Status: 500 Internal Server Error
I/flutter (30836): ║  https://myBackendDomain.com/carRent/api/index.php/auth/send_email_to_user
I/flutter (30836): ╚══════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter (30836): ╔ DioErrorType.response
I/flutter (30836): ╚══════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter (30836): 
I/flutter (30836): DioError [DioErrorType.response]: Http status error [500]
I/flutter (30836): runZonedGuarded: Caught error in my root zone.
I/flutter (30836): ----------------FIREBASE CRASHLYTICS----------------
I/flutter (30836): Unhandled error DioError [DioErrorType.response]: Http status error [500]
I/flutter (30836): Source stack:
I/flutter (30836): #0      DioMixin.fetch (package:dio/src/dio_mixin.dart:473:35)
I/flutter (30836): #1      DioMixin.request (package:dio/src/dio_mixin.dart:468:12)
I/flutter (30836): #2      DioMixin.post (package:dio/src/dio_mixin.dart:91:12)
I/flutter (30836): #3      sendEmail (package:rentors/repo/LoginRepo.dart:73:30)
I/flutter (30836): #4      LoginBloc.mapEventToState (package:rentors/bloc/LoginBloc.dart:36:26)
I/flutter (30836): <asynchronous suspension>
I/flutter (30836):  occurred in Instance of 'LoginBloc'.
I/flutter (30836): #0      DioMixin.fetch.<anonymous closure> (package:dio/src/dio_mixin.dart:628:7)
I/flutter (30836): #1      _rootRunBinary (dart:async/zone.dart:1450:47)
I/flutter (30836): #2      _CustomZone.runBinary (dart:async/zone.dart:1342:19)
I/flutter (30836): #3      _FutureListener.handleError (dart:async/future_impl.dart:162:22)
I/flutter (30836): #4      Future._propagateToListeners.handleError (dart:async/future_impl.dart:778:47)
I/flutter (30836): #5      Future._propagateToListeners (dart:async/future_impl.dart:799:13)
I/flutter (30836): #6      Future._completeError (dart:async/future_impl.dart:574:5)
I/flutter (30836): #7      _SyncCompleter._completeError (dart:as
I/flutter (30836): 
I/flutter (30836): #0      BlocBase.onError.<anonymous closure> (package:bloc/src/bloc.dart:743:7)
I/flutter (30836): #1      BlocBase.onError (package:bloc/src/bloc.dart:744:6)
I/flutter (30836): #2      _rootRunBinary (dart:async/zone.dart:1450:47)
I/flutter (30836): #3      _CustomZone.runBinary (dart:async/zone.dart:1342:19)
I/flutter (30836): #4      _CustomZone.runBinaryGuarded (dart:async/zone.dart:1252:7)
I/flutter (30836): #5      _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:360:15)
I/flutter (30836): #6      _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:378:7)
I/flutter (30836): #7      _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:280:7)
I/flutter (30836): #8      _SyncBroadcastStreamController._sendError.<anonymous closure> (dart:async/broadcast_stream_controller.dart:392:20)
I/flutter (30836): #9      _BroadcastStreamController._forEachListener (dart:async/broadcast_stream_controller.dart:322:15)
I/flutter (30836): #10     _SyncBroadcastStreamController._sendError (dart:async/broadcast_stream_controller.dart:391:5)
I/flutter (30836): #11     _BroadcastStreamController._addError (dart:async/broadcast_stream_controller.dart:289:5)
I/flutter (30836): #12     _ro
I/flutter (30836): ----------------------------------------------------

Catch DioError and handle an internal server error.捕获DioError并处理内部服务器错误。

try {
...
  final result = await dio.post('https://myBackendDomain.com/carRent/api/index.php/auth/send_email_to_user', data: ...);
...
} on DioError catch (e) {
  // The request was made and the server responded with a status code
  // that falls out of the range of 2xx and is also not 304.
...
}

See Handling Errors for details.有关详细信息,请参阅处理错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 DioError [DioErrorType.RESPONSE]:Http 状态错误 [500],为什么? - DioError [DioErrorType.RESPONSE]: Http status error [500], why? Flutter DioError [DioErrorType.RESPONSE]: Http 状态错误 [403] - Flutter DioError [DioErrorType.RESPONSE]: Http status error [403] Flutter Dio:DioError [DioErrorType.RESPONSE]:Http 状态错误 [429] - Flutter Dio : DioError [DioErrorType.RESPONSE]: Http status error [429] DioError [DioErrorType.response] Http 状态错误 [404] - flutter - DioError [DioErrorType.response] Http status error [404] - flutter I/flutter (23942): DioError [DioErrorType.RESPONSE]: Http 状态错误 [500] - I/flutter (23942): DioError [DioErrorType.RESPONSE]: Http status error [500] DioErrorType.RESPONSE:Http 状态错误 [500](颤振) - DioErrorType.RESPONSE: Http status error [500] (Flutter) DioError [DioErrorType.RESPONSE]: Http 状态错误 [400] 异常 - DioError [DioErrorType.RESPONSE]: Http status error [400] Exception 无法捕获 dioerror [dioerrortype.response]:http 状态错误 [statusCode] - Unable to catch dioerror [dioerrortype.response]: http status error [statusCode] DioError [DioErrorType.RESPONSE]: Http 状态错误 [405] [已解决] - DioError [DioErrorType.RESPONSE]: Http status error [405] [Solved] DioError [DioErrorType.response]:Http 状态错误 [401] - DioError [DioErrorType.response]: Http status error [401]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM