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

JS: DeleteConsumer not found errors should be sentinel errors #751

Closed
sloveridge opened this issue Jun 17, 2021 · 1 comment
Closed

JS: DeleteConsumer not found errors should be sentinel errors #751

sloveridge opened this issue Jun 17, 2021 · 1 comment
Assignees

Comments

@sloveridge
Copy link

sloveridge commented Jun 17, 2021

Some of the errors reported from DeleteConsumer look to be just passed on from Nats Server and should probably be sentinel errors to be consistent with the rest of nats.go

Example:

package main

import (
	"fmt"
	"github.com/nats-io/nats.go"
)

func main() {
	nc, _ := nats.Connect(nats.DefaultURL)
	js, _ := nc.JetStream()
	if err := js.DeleteConsumer("TEST", "test"); err != nil {
		fmt.Println(err)
	}
	js.AddStream(&nats.StreamConfig{Name: "TEST"})
	if err := js.DeleteConsumer("TEST", "test"); err != nil {
		fmt.Println(err)
	}
	js.DeleteStream("TEST")
	nc.Close()
}

I would expect something like:

var (
    ErrStreamNotFound    = errors.New("nats: stream not found")
    ErrConsumerNotFound   = errors.New("nats: consumer not found")
)
@sloveridge sloveridge changed the title DeleteConsumer not found errors should be sentinel errors JS: DeleteConsumer not found errors should be sentinel errors Jun 17, 2021
@wallyqs
Copy link
Member

wallyqs commented Jul 1, 2021

Fixed via #760

@wallyqs wallyqs closed this as completed Jul 1, 2021
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

3 participants