Change sbot::init to not panic and instead return an error #51

Merged
notplants merged 3 commits from no-panic into main 2022-07-16 05:57:36 +00:00
Owner

not panicing is required for the error handling I'm building in peach_config::wait-for-sbot and is I think a better practice in general

not panicing is required for the error handling I'm building in peach_config::wait-for-sbot and is I think a better practice in general
notplants added 2 commits 2022-07-12 11:14:48 +00:00
notplants requested review from glyph 2022-07-12 11:30:52 +00:00
glyph approved these changes 2022-07-12 15:42:04 +00:00
glyph left a comment
Owner

Great. A long-overdue addition. Thanks!

Great. A long-overdue addition. Thanks!
glyph requested changes 2022-07-14 08:26:24 +00:00
glyph left a comment
Owner

Made a comment about error variants.

Made a comment about error variants.
src/error.rs Outdated
@ -35,2 +35,4 @@
/// Go-sbot error.
Sbot(String),
/// Error initializing Go-sbot.
SbotInit(String),
Owner

Taking a second look at this: I suggest using the existing Sbot(String) error variant rather than creating an additional variant (SbotInit(String)).

I've found it easier for maintenance to keep a smaller number of variants which bundle together errors of like kind.

Taking a second look at this: I suggest using the existing `Sbot(String)` error variant rather than creating an additional variant (`SbotInit(String)`). I've found it easier for maintenance to keep a smaller number of variants which bundle together errors of like kind.
Author
Owner

Agreed I like having fewer variants too. Even having more generic error types, and using the string "message" within the error for giving more details, could even help debug, such that the the specific string in the "message" can help debug exactly where the error comes from.

Agreed I like having fewer variants too. Even having more generic error types, and using the string "message" within the error for giving more details, could even help debug, such that the the specific string in the "message" can help debug exactly where the error comes from.
Author
Owner

in this case I separated them initially because the Sbot error type said "sbot returned an error response",
which is not technically what these sbot intialization errors are. so I changed that error message template too to combine them

in this case I separated them initially because the Sbot error type said "sbot returned an error response", which is not technically what these sbot intialization errors are. so I changed that error message template too to combine them
notplants added 1 commit 2022-07-15 09:17:16 +00:00
glyph approved these changes 2022-07-15 09:54:23 +00:00
glyph left a comment
Owner

Thanks for the update. I like the improvement you made to the main Sbot error message.

🙏 🖤

Thanks for the update. I like the improvement you made to the main `Sbot` error message. 🙏 🖤
notplants merged commit 3c37297018 into main 2022-07-16 05:57:36 +00:00
notplants deleted branch no-panic 2022-07-16 05:57:37 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: golgi-ssb/golgi#51
No description provided.