From c70da0f54877c95029b5a77f23e39b8b31653c6d Mon Sep 17 00:00:00 2001 From: sophia Date: Thu, 6 Jan 2022 17:02:43 -0600 Subject: [PATCH] Raise Vagrant error --- plugins/commands/serve/service/capability_platform_service.rb | 4 +++- plugins/commands/serve/util/service_info.rb | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/commands/serve/service/capability_platform_service.rb b/plugins/commands/serve/service/capability_platform_service.rb index 9bda931c4..66a074849 100644 --- a/plugins/commands/serve/service/capability_platform_service.rb +++ b/plugins/commands/serve/service/capability_platform_service.rb @@ -85,7 +85,9 @@ module VagrantPlugins target_cap = caps_registry.get(cap_name) if target_cap.nil? - raise "Failed to locate requested capability `#{cap_name.inspect}' on plugin #{plugin_name}" + raise Vagrant::Errors::CapabilityNotFound, + cap: cap_name.inspect, + host: plugin_name end args = mapper.funcspec_map( diff --git a/plugins/commands/serve/util/service_info.rb b/plugins/commands/serve/util/service_info.rb index 8d63a48d7..dfd109d7e 100644 --- a/plugins/commands/serve/util/service_info.rb +++ b/plugins/commands/serve/util/service_info.rb @@ -26,8 +26,8 @@ module VagrantPlugins return if !block_given? begin yield info - rescue => e - raise "#{e.class}: #{e}\n#{e.backtrace.join("\n")}" + rescue + raise ensure Service::ServiceInfo.manager_tracker.deactivate do Vagrant.plugin("2").disable_remote_manager