Skip to content

Commit fde3b70

Browse files
Add exception and comments to explain the issue
1 parent 8b1e2c9 commit fde3b70

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

lib/better_errors/error_page_style.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,20 @@ module BetterErrors
22
# @private
33
module ErrorPageStyle
44
def self.compiled_css(for_deployment = false)
5-
require "sassc"
5+
begin
6+
require "sassc"
7+
rescue LoadError
8+
raise LoadError, "The `sassc` gem is required when developing the `better_errors` gem. "\
9+
"If you're using a release of `better_errors`, the compiled CSS is missing from the released gem"
10+
# If you arrived here because sassc is not in your project's Gemfile,
11+
# the issue here is that the release of the better_errors gem
12+
# is supposed to contain the compiled CSS, but that file is missing from the release.
13+
# So better_errors is trying to build the CSS on the fly, which requires the sassc gem.
14+
#
15+
# If you're developing the better_errors gem locally, and you're running a project
16+
# that does not have sassc in its bundle, run `rake style:build` in the better_errors
17+
# project to compile the CSS file.
18+
end
619

720
style_dir = File.expand_path("style", File.dirname(__FILE__))
821
style_file = "#{style_dir}/main.scss"

0 commit comments

Comments
 (0)