Skip to content

Commit

Permalink
log and re-raise error if load unexpectedly fails (#933)
Browse files Browse the repository at this point in the history
  • Loading branch information
kickster97 authored Feb 7, 2025
1 parent 024adec commit 5537a67
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lavinmq/parameter_store.cr
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ module LavinMQ
end
end
@log.debug { "#{size} items loaded from #{@file_name}" }
rescue ex
@log.error(exception: ex) { "Failed to load #{@file_name}" }
raise ex
end
end
end
3 changes: 3 additions & 0 deletions src/lavinmq/user_store.cr
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ module LavinMQ
end
create_direct_user
Log.debug { "#{size} users loaded" }
rescue ex
Log.error(exception: ex) { "Failed to load users" }
raise ex
end

private def create_direct_user
Expand Down
3 changes: 3 additions & 0 deletions src/lavinmq/vhost_store.cr
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ module LavinMQ
create("/")
end
Log.debug { "#{size} vhosts loaded" }
rescue ex
Log.error(exception: ex) { "Failed to load vhosts" }
raise ex
end

private def save!
Expand Down

0 comments on commit 5537a67

Please sign in to comment.