Return error instead of using panic() in the Reactor#475
Return error instead of using panic() in the Reactor#475NGTmeaty merged 1 commit intointernetarchive:mainfrom
Conversation
Methods `ReceiveFeedback` and `ReceiveInsert` already return `error`. We call `reactor.ReceiveFeedback` in the finisher and we terminate when there is an error so the program behavior doesn't change. https://github.com/internetarchive/Zeno/blob/main/internal/pkg/finisher/finisher.go#L122 We call `reactor.ReceiveInsert` in the pipeline and we terminate when there is an error so the program behavior doesn't change. https://github.com/internetarchive/Zeno/blob/main/internal/pkg/controler/pipeline.go#L161 `models.ErroNotASeed` is already defined, there is no need to make a new error. Define `ErrReactorItemPresent` because there is no relevant reactor error. Relevant to issue: internetarchive#473
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #475 +/- ##
==========================================
+ Coverage 56.45% 56.48% +0.02%
==========================================
Files 130 130
Lines 8052 8055 +3
==========================================
+ Hits 4546 4550 +4
+ Misses 3145 3144 -1
Partials 361 361
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
NGTmeaty
left a comment
There was a problem hiding this comment.
Nice catch! Looks like a good improvement to me!
this is a serious regressionthe reactor is the component that guarantees Zeno is working as expected and if one of those errors that was previously a panic goes uncatched this might cause unhandled chaos i encourage you to revert this ASAP panics are here cause they should be, it's not a fantasy, the program should CRASH immediately if a non seed gets into the reactor, it's here to catch a programming error not a runtime error |
|
@equals215 the program will be terminated with a
https://github.com/internetarchive/Zeno/blob/main/internal/pkg/finisher/finisher.go#L98 |
|
it's not the caller responsibility to |
|
Well, we have a different opinion on this matter. Anyway, its not for me to decide, its up to the lead contributor. Thank you. |
Methods
ReceiveFeedbackandReceiveInsertalready returnerror.We call
reactor.ReceiveFeedbackin the finisher and we terminate when there is an error so the program behavior doesn't change. https://github.com/internetarchive/Zeno/blob/main/internal/pkg/finisher/finisher.go#L122We call
reactor.ReceiveInsertin the pipeline and we terminate when there is an error so the program behavior doesn't change. https://github.com/internetarchive/Zeno/blob/main/internal/pkg/controler/pipeline.go#L161models.ErroNotASeedis already defined, there is no need to make a new error.Define
ErrReactorItemPresentbecause there is no relevant reactor error.Relevant to issue: #473