-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Don't Panic in the Server #497
Comments
The logic of Therefore, we have decided to replace panic with errors in the |
The list of panics that need to be replaced with $ grep panic pkg -R
pkg/document/crdt/element_rht.go: panic("fail to find: " + elem.CreatedAt().Key())
pkg/document/crdt/tree.go: panic(fmt.Errorf("cannot find node at %p", pos))
pkg/document/crdt/tree.go: panic(fmt.Errorf("cannot find node at %p", pos))
pkg/document/crdt/tree.go: panic(errors.New("left and right are not in the same list"))
pkg/document/crdt/rga_tree_list.go: panic("fail to find the given createdAt: " + createdAt.Key())
pkg/document/crdt/rga_tree_list.go: panic("fail to find the given prevCreatedAt: " + prevCreatedAt.Key())
pkg/document/crdt/rga_tree_list.go: panic("fail to find the given createdAt: " + createdAt.Key())
pkg/document/crdt/rga_tree_list.go: panic("fail to find the given prevCreatedAt: " + createdAt.Key())
pkg/document/crdt/rga_tree_list.go: panic("fail to find the given createdAt: " + elem.CreatedAt().Key())
pkg/document/crdt/rga_tree_list.go: panic("fail to find the given createdAt: " + createdAt.Key())
pkg/document/crdt/rga_tree_split.go: panic("RGATreeSplitNodeID cannot be null")
pkg/document/crdt/primitive.go: panic("unsupported type")
pkg/document/crdt/primitive.go: panic("unsupported type")
pkg/document/crdt/primitive.go: panic("unsupported type")
pkg/document/crdt/primitive.go: panic("unsupported type")
pkg/document/crdt/counter.go: panic("unsupported type")
pkg/document/crdt/counter.go: panic("unsupported type")
pkg/document/crdt/counter.go: panic("unsupported type")
pkg/document/crdt/counter.go: panic("unsupported type")
pkg/document/crdt/counter.go: panic("unsupported type")
pkg/document/crdt/counter.go: panic("unsupported type")
pkg/document/crdt/counter.go: panic("unsupported type")
pkg/document/document.go: panic(err)
pkg/index/tree.go: panic(fmt.Sprintf("from cannot be greater than to %d > %d", from, to))
pkg/index/tree.go: panic(fmt.Sprintf("from is out of range %d > %d", from, root.Length))
pkg/index/tree.go: panic(fmt.Sprintf("to is out of range %d > %d", to, root.Length))
pkg/index/tree.go: panic(errors.New("text node cannot have children"))
pkg/index/tree.go: panic(errors.New("text node cannot have children"))
pkg/index/tree.go: panic(errors.New("text node cannot have children"))
pkg/index/tree.go: panic(errors.New("text node cannot have children"))
pkg/index/tree.go: panic(errors.New("prevNode is not a child of the node"))
pkg/index/tree.go: panic(errors.New("text node cannot have children"))
pkg/index/tree.go: panic(errors.New("text node cannot have children"))
pkg/index/tree.go: panic(errors.New("text node cannot have children"))
pkg/index/tree.go: panic(errors.New("text node cannot have children"))
pkg/index/tree.go: panic(errors.New("text node cannot have children"))
pkg/index/tree.go: panic(errors.New("text node cannot have children"))
pkg/index/tree.go: panic(errors.New("child not found"))
pkg/index/tree.go: panic(errors.New("text node cannot have children"))
pkg/index/tree.go: panic(errors.New("child not found"))
pkg/index/tree.go: panic(fmt.Errorf("index is out of range: %d > %d", index, node.Length))
pkg/index/tree.go: panic("invalid treePos")
pkg/index/tree.go: panic("invalid treePos")
pkg/index/tree.go: panic("unacceptable path")
pkg/index/tree.go: panic("unacceptable path")
pkg/index/tree.go: panic("unacceptable path")
pkg/index/tree.go: panic("unacceptable path")
pkg/index/tree.go: panic(errors.New("parent is not found")) |
some tasks have been done from #570 I'll leave checkboxes for remaining tasks
|
May I try this for |
@sejongk Give it a try. 💪 |
May I work on |
@MoonGyu1 Sure. If you have any questions, please let me know. |
Only the primitive remains:
|
May I try this for |
@fourjae Sure! |
Description:
We often use panic in development to reveal errors, but codes running in production must avoid panic to prevent stopping the server.
Refer to https://github.com/uber-go/guide/blob/master/style.md#dont-panic
Why:
The text was updated successfully, but these errors were encountered: