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

Return error if session is not connected #60

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

muzzammilshahid
Copy link
Member

No description provided.

session.go Outdated
@@ -308,8 +308,15 @@ func (s *Session) processIncomingMessage(msg messages.Message) error {
return nil
}

func (s *Session) IsConnected() bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (s *Session) IsConnected() bool {
func (s *Session) Connected() bool {

Copy link
Member

@om26er om26er left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to change this for all actions

session.go Outdated
func (s *Session) Register(procedure string, handler InvocationHandler,
options map[string]any) (*Registration, error) {
if !s.Connected() {
return nil, fmt.Errorf("session not connected")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the error message should be tailered for each type of WAMP actions.

Suggested change
return nil, fmt.Errorf("session not connected")
return nil, fmt.Errorf("cannot register procedure: session not established")

@om26er om26er merged commit 33f83e2 into xconnio:main Oct 28, 2024
1 check passed
@muzzammilshahid muzzammilshahid deleted the is-session-connected branch December 27, 2024 14:41
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

Successfully merging this pull request may close these issues.

None yet

2 participants