sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Throw exception when required file does not exist?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 255 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      Jim
      last edited by

      I wanted to do this:

      
      begin
        require 'file'
      rescue 
        # 
      end
      
      

      But it does work? Why not?

      I know I can do it other ways, but I'm just curious if there's a reason for the behavior.

      Hi

      1 Reply Last reply Reply Quote 0
      • AdamBA Offline
        AdamB
        last edited by

        rescue with no argument will default to StandardError.
        What you want is:

        begin require 'foods' rescue LoadError puts "not there" end

        Developer of LightUp Click for website

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by

          Ah! Thank you Adam.

          But I think I may just be being too lazy to check if the files exists...

          Hi

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement