summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-09-23 15:30:24 +0200
committerSamuel Giddins <segiddins@segiddins.me>2016-09-23 15:30:24 +0200
commit67a0178486b5290c9f7cf9d95bcddee2a623aef8 (patch)
tree3538572637d5f1234fcb204e2abbeb326eec2f3a
parent03633e15bfb4763ab7015f4abe6ca4ec1938d759 (diff)
downloadbundler-seg-jruby-oom-error-message.tar.gz
[FriendlyErrors] Print a custom message on Java::JavaLang::OutOfMemoryErrorseg-jruby-oom-error-message
-rw-r--r--lib/bundler/friendly_errors.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb
index df45dd6946..c2853294a7 100644
--- a/lib/bundler/friendly_errors.rb
+++ b/lib/bundler/friendly_errors.rb
@@ -37,6 +37,11 @@ module Bundler
when Gem::InvalidSpecificationException
Bundler.ui.error error.message, :wrap => true
when SystemExit
+ when *[defined?(Java::JavaLang::OutOfMemoryError) && Java::JavaLang::OutOfMemoryError].compact
+ Bundler.ui.error "\nYour JVM has run out of memory, and Bundler cannot continue. " \
+ "You can decrease the amount of memory Bundler needs by removing gems from your Gemfile, " \
+ "especially large gems. (Gems can be as large as hundreds of megabytes, and Bundler has to read those files!). " \
+ "Alternatively, you can increase the amount of memory the JVM is able to use by running Bundler with jruby -J-Xmx1024m -S bundle (JRuby defaults to 500MB)."
else request_issue_report_for(error)
end
end