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

TypeError thrown in _ClientImpl._handleException #104

Closed
rajmaniar opened this issue Aug 15, 2023 · 4 comments · Fixed by #105
Closed

TypeError thrown in _ClientImpl._handleException #104

rajmaniar opened this issue Aug 15, 2023 · 4 comments · Fixed by #105

Comments

@rajmaniar
Copy link
Contributor

I don't know the how to reproduce this but we just saw this in our logs:

type '_CastError' is not a subtype of type 'Exception'


package:dart_amqp/src/client/impl/client_impl.dart 225          _ClientImpl._handleException
package:dart_amqp/src/client/impl/client_impl.dart 189          _ClientImpl._handleMessage
dart:async                                                      _EventSinkWrapper.add
package:dart_amqp/src/protocol/io/amqp_message_decoder.dart 42  AmqpMessageDecoder.handleData
dart:async                                                      _EventSinkWrapper.add
package:dart_amqp/src/protocol/io/raw_frame_parser.dart 79      RawFrameParser.handleData

It seems like there might be two issues here:

  • _handleException accepts a dynamic error but is trying to add it to the error stream which is typed Exception
  • What in the _handleMessage is throwing the CastError
@achilleasa
Copy link
Owner

That's an odd error... Are you getting this with v0.2.5 of the client?

achilleasa added a commit that referenced this issue Aug 15, 2023
…lose message

This commit attempts to fix issue #104 by using a ?? operator to avoid
raising a _CastError if a ConnectionClose message does not include a
replyText field.
@achilleasa
Copy link
Owner

It looks like a _CastError is raised when a null check operator is used on a null value.

I examined the handleMessage implementation and found one potential location where this might happen (the other null checks in that method is unlikely to be used against a null value). Can you try the linked PR and let me know if the issue surfaces again?

@rajmaniar
Copy link
Contributor Author

Thanks! I'll pull your branch in and see if it happens again.

@rajmaniar
Copy link
Contributor Author

I forgot to report back, this fixed the null check issue. Feel free to close and merge the associated PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants