From 041550cc0f3d864209fe03db386517632ecf72eb Mon Sep 17 00:00:00 2001 From: Glenn Date: Fri, 24 Nov 2023 19:25:21 +0100 Subject: [PATCH] fix: handle mount errors (with the right message) --- src/models/concerns/base.cr | 9 +++++++-- src/models/gocryptfs_config.cr | 5 +---- src/models/httpdirfs_config.cr | 5 +---- src/models/sshfs_config.cr | 5 +---- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/models/concerns/base.cr b/src/models/concerns/base.cr index a5afda5..a12fab2 100644 --- a/src/models/concerns/base.cr +++ b/src/models/concerns/base.cr @@ -42,9 +42,14 @@ module GX::Models::Concerns return end - yield + result_status = yield - puts "Models #{name} is now available on #{mount_point_safe}".colorize(:green) + if result_status.success? + puts "Models #{name} is now available on #{mount_point_safe}".colorize(:green) + else + puts "Error mounting the vault".colorize(:red) + return + end end end diff --git a/src/models/gocryptfs_config.cr b/src/models/gocryptfs_config.cr index 5d08263..3cbcd61 100644 --- a/src/models/gocryptfs_config.cr +++ b/src/models/gocryptfs_config.cr @@ -32,10 +32,7 @@ module GX::Models output: STDOUT, error: STDERR ) - unless process.wait.success? - puts "Error mounting the vault".colorize(:red) - return - end + return process.wait end end end diff --git a/src/models/httpdirfs_config.cr b/src/models/httpdirfs_config.cr index c175558..fdcf012 100644 --- a/src/models/httpdirfs_config.cr +++ b/src/models/httpdirfs_config.cr @@ -32,10 +32,7 @@ module GX::Models output: STDOUT, error: STDERR ) - unless process.wait.success? - puts "Error mounting the filesystem".colorize(:red) - return - end + return process.wait end end end diff --git a/src/models/sshfs_config.cr b/src/models/sshfs_config.cr index c7e5853..fee42e5 100644 --- a/src/models/sshfs_config.cr +++ b/src/models/sshfs_config.cr @@ -39,10 +39,7 @@ module GX::Models output: STDOUT, error: STDERR ) - unless process.wait.success? - puts "Error mounting the filesystem".colorize(:red) - return - end + return process.wait end end end