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

Panic on Finish seems problematic? #20

Open
thehydroimpulse opened this issue Mar 30, 2017 · 1 comment
Open

Panic on Finish seems problematic? #20

thehydroimpulse opened this issue Mar 30, 2017 · 1 comment

Comments

@thehydroimpulse
Copy link

thehydroimpulse commented Mar 30, 2017

Could we simply return an error type instead of panicing? This seems like a recoverable error to me.

cc @achille-roussel

panic: (*Message).Finish or (*Message).Requeue has already been called
goroutine 8 [running]:
github.com/segmentio/nsq-go.(*Message).Finish(0xc4205ffe68)
	/go/src/github.com/segmentio/nsq-go/message.go:72 +0x155
github.com/segmentio/integration-discards-archiver.(*nsqInput).handleMessage(0xc420145b90, 0xc4205ffe68)
	/go/src/github.com/segmentio/integration-discards-archiver/nsq.go:136 +0x327
github.com/segmentio/integration-discards-archiver.(*nsqInput).Consume(0xc420145b90, 0x9ba560, 0xc420018f80, 0x0, 0x0)
	/go/src/github.com/segmentio/integration-discards-archiver/nsq.go:71 +0x1d4
main.main.func1(0xc420145b90, 0x9ba560, 0xc420018f80, 0xc42001d950)
	/go/src/github.com/segmentio/integration-discards-archiver/cmd/archiver.go:102 +0x43
created by main.main
	/go/src/github.com/segmentio/integration-discards-archiver/cmd/archiver.go:107 +0x48a

I can send a PR if needed

@achille-roussel
Copy link
Contributor

achille-roussel commented Mar 30, 2017

I disagree, this is a programming error, the program is misusing the package so a panic seems appropriate.
It's kind of like closing a channel twice, it panics because it doesn't make sense.

Also, it's documented.

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