Skip to content

Do not swallow all exceptions on render #5495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2016
Merged

Do not swallow all exceptions on render #5495

merged 1 commit into from
Oct 20, 2016

Conversation

pathawks
Copy link
Member

@pathawks pathawks commented Oct 19, 2016

Fixes #5104

@pathawks
Copy link
Member Author

/cc: @jekyll/build

@pathawks
Copy link
Member Author

Digging into this a bit deeper, I can trace this all the way back to commit number two, when this was still called autoblog 7dfe32a

Here is what the function looked like:

    def read_layouts
      base = File.join(self.root, "_layouts")
      dir = Dir.new(base)
      dir.each do |f|
        unless %w{. ..}.include?(f)
          name = f.split(".")[0..-2].join(".")
          self.layouts[name] = File.read(File.join(base, f))
        end
      end
    rescue Errno::ENOENT => e
      # ignore missing layout dir
    end

So, it looks like this was not ever meant to swallow some exception in a called function, it was doing all the business right there. I guess we've just carried the cruft along and now here we are, eight years later.

@parkr
Copy link
Member

parkr commented Oct 19, 2016

Probably from the File.read call. I'd be interested in just doing a File.exist? call there instead.

@pathawks
Copy link
Member Author

Probably from the File.read call. I'd be interested in just doing a File.exist? call there instead.

Sorry to confuse; the code that I posted there is way old and gone. Was just trying to show why this rescue was originally added. We currently don't have any File.read calls 👍

Copy link
Member

@parkr parkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pathawks Merge as +bug when CI passes. 😄

@pathawks
Copy link
Member Author

when CI passes

You mean appveyor? master is failing on appveyor

@parkr
Copy link
Member

parkr commented Oct 20, 2016

@pathawks Nope! Travis was failing earlier. I kicked it and it passed. 😄

@jekyllbot: merge +bug

@jekyllbot jekyllbot merged commit eca7f46 into master Oct 20, 2016
@jekyllbot jekyllbot deleted the pr/layouts-error branch October 20, 2016 04:24
jekyllbot added a commit that referenced this pull request Oct 20, 2016
@envygeeks envygeeks self-assigned this Oct 22, 2016
@jekyll jekyll locked and limited conversation to collaborators Jul 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Site.render() swallows all Errno::ENOENT exceptions, leading to silent build failures
5 participants