def in_bolt_compiler
      r = Puppet::Pal.in_tmp_environment('bolt', modulepath: @modulepath, facts: {}) do |pal|
        pal.with_script_compiler do |compiler|
          alias_types(compiler)
          begin
            Puppet.override(yaml_plan_instantiator: Bolt::PAL::YamlPlan::Loader) do
              yield compiler
            end
          rescue Bolt::Error => e
            e
          rescue Puppet::PreformattedError => e
            PALError.from_preformatted_error(e)
          rescue StandardError => e
            PALError.from_preformatted_error(e)
          end
        end
      end

      # Plans may return PuppetError but nothing should be throwing them
      if r.is_a?(StandardError) && !r.is_a?(Bolt::PuppetError)
        raise r
      end
      r
    end
def in_bolt_compiler
      r = Puppet::Pal.in_tmp_environment('bolt', modulepath: @modulepath, facts: {}) do |pal|
        pal.with_script_compiler do |compiler|
          alias_types(compiler)
          begin
            Puppet.override(yaml_plan_instantiator: Bolt::PAL::YamlPlan::Loader) do
              yield compiler
            end
          rescue Bolt::Error => e
            e
          rescue Puppet::PreformattedError => e
            PALError.from_preformatted_error(e)
          rescue StandardError => e
            PALError.from_preformatted_error(e)
          end
        end
      end

      # Plans may return PuppetError but nothing should be throwing them
      if r.is_a?(StandardError) && !r.is_a?(Bolt::PuppetError)
        raise r
      end
      r
    end
Runs a block in a PAL script compiler configured for Bolt.  Catches
 exceptions thrown by the block and re-raises them ensuring they are
 Bolt::Errors since the script compiler block will squash all exceptions.