Skip to content

Commit

Permalink
Add error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nakabonne committed Apr 30, 2020
1 parent 0395406 commit cdd903f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/gui/item/source_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ func NewSourceFiles(rootDir string) *SourceFiles {
SetTitle("Source Files").
SetTitleAlign(tview.AlignLeft)

s.addChildren(root, rootDir)
if err := s.addChildren(root, rootDir); err != nil {
panic(err) // TODO: Emit log instead of panic
}
return s
}

Expand Down Expand Up @@ -80,7 +82,9 @@ func (s *SourceFiles) SwitchToggle(node *tview.TreeNode) {
if len(children) == 0 {
// Load and show files in this directory.
path := reference.(string)
s.addChildren(node, path)
if err := s.addChildren(node, path); err != nil {
panic(err) // TODO: Emit log instead of panic
}
} else {
// Collapse if visible, expand if collapsed.
node.SetExpanded(!node.IsExpanded())
Expand Down

0 comments on commit cdd903f

Please sign in to comment.