mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-26 23:45:52 +03:00
[GH-ISSUE #340] [BUG] GetTaskInfo doesn't return expected errors #150
Labels
No labels
CLI
bug
designing
documentation
duplicate
enhancement
good first issue
good first issue
help wanted
idea
invalid
investigate
needs-more-info
performance
pr-welcome
pull-request
question
wontfix
work in progress
work in progress
work-around-available
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/asynq#150
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jonnyguio on GitHub (Nov 9, 2021).
Original GitHub issue: https://github.com/hibiken/asynq/issues/340
Originally assigned to: @hibiken on GitHub.
Describe the bug
The method
GetTaskInfoof theInspectordoesn't return the expected error: it creates a new error appending the two possible errors to the stringasynq:.To Reproduce
Expected behavior
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
Additional context
The documentation states:
I believe that returning a new error, even if it can be helpful to know that the context of the error was from
asynq, it's misleading from the actual implementation and makes handling of an expected scenario not as good as straight comparisson between errors.@hibiken commented on GitHub (Nov 9, 2021):
@jonnyguio Thank you for opening an issue!
I believe this is a documentation bug, Inspector is returning an error that wraps those sentinel error values (to allow for flexibility in adding more context in the error in the future if needed).
So instead of directly comparing to the error value, the user of the package needs to unwrap it:
This pattern was taken from this blog: https://go.dev/blog/go1.13-errors
Thanks again for spotting this, I'll update the godoc 👍
@jonnyguio commented on GitHub (Nov 9, 2021):
Oh, that's great! That makes a lot of sense, I missed this way of handling it.
Keep it up with the good work! 😄