[GH-ISSUE #659] In the treeview example (demos) when the directory visited does not have read permission, the app crashes #484

Closed
opened 2026-03-04 01:05:24 +03:00 by kerem · 4 comments
Owner

Originally created by @serge-hulne on GitHub (Sep 30, 2021).
Original GitHub issue: https://github.com/rivo/tview/issues/659

In the treeview example (demos) when the directory visited does not have read permission, the app crashes :

https://github.com/rivo/tview/tree/master/demos/treeview

Originally created by @serge-hulne on GitHub (Sep 30, 2021). Original GitHub issue: https://github.com/rivo/tview/issues/659 In the treeview example (demos) when the directory visited does not have read permission, the app crashes : https://github.com/rivo/tview/tree/master/demos/treeview
kerem closed this issue 2026-03-04 01:05:24 +03:00
Author
Owner

@rivo commented on GitHub (Sep 30, 2021):

I know. I wouldn't say it crashes, it panics. It's not meant to be a fully featured file browser. It just demonstrates the use of the TreeView primitive.

<!-- gh-comment-id:931507482 --> @rivo commented on GitHub (Sep 30, 2021): I know. I wouldn't say it crashes, it panics. It's not meant to be a fully featured file browser. It just demonstrates the use of the `TreeView` primitive.
Author
Owner

@serge-hulne commented on GitHub (Sep 30, 2021):

Thanks!
How could I catch this exception?

<!-- gh-comment-id:931511708 --> @serge-hulne commented on GitHub (Sep 30, 2021): Thanks! How could I catch this exception?
Author
Owner

@rivo commented on GitHub (Sep 30, 2021):

It's uncommon to catch panics in Golang. You'll need to decide what to do with a directory for which you don't have permission, then do that instead of panicking. This is where it happens:

github.com/rivo/tview@ee97a7ab39/demos/treeview/main.go (L26)

<!-- gh-comment-id:931528432 --> @rivo commented on GitHub (Sep 30, 2021): It's uncommon to catch panics in Golang. You'll need to decide what to do with a directory for which you don't have permission, then do that instead of panicking. This is where it happens: https://github.com/rivo/tview/blob/ee97a7ab3975c51dba32df8979eb97b31cada430/demos/treeview/main.go#L26
Author
Owner

@serge-hulne commented on GitHub (Sep 30, 2021):

Thank you!

<!-- gh-comment-id:931532185 --> @serge-hulne commented on GitHub (Sep 30, 2021): Thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
starred/tview#484
No description provided.