Skip to content

Commit

Permalink
snapshot: Handle errors with unknown snapshot IDs
Browse files Browse the repository at this point in the history
(cherry picked from commit 6b8b5ca)
  • Loading branch information
neverpanic authored and jmroot committed Jul 25, 2024
1 parent 1dcbcf5 commit 99d49c9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/macports1.0/snapshot.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ namespace eval snapshot {
ui_msg " port snapshot --delete <snapshot-id>"
}

proc main {opts} {
# Function to create a snapshot of the current state of ports.
proc main {opts} {
# Function to create a snapshot of the current state of ports.
#
# Args:
# opts - The options passed in.
Expand Down Expand Up @@ -110,7 +110,10 @@ namespace eval snapshot {
return 0
}
"diff" {
set snapshot [registry::snapshot get_by_id [dict get $opts ports_snapshot_diff]]
if {[catch {set snapshot [registry::snapshot get_by_id [dict get $opts ports_snapshot_diff]]} result]} {
ui_error "Failed to obtain snapshot with ID [dict get $opts ports_snapshot_diff]: $result"
return 1
}
array set diff [diff $snapshot]
set show_all [dict exists $opts ports_snapshot_all]
set note ""
Expand Down

0 comments on commit 99d49c9

Please sign in to comment.