Closed dawncold closed 7 years ago
Yeah, you had another issue, which isn't super clear -- but the real problem is that the rescue error is trying to print a local var it can't reach (as you suspected). We can fix up the error message, but if you change that line to the following, and re-run your app, it should give clearer indication to what's going on:
$stderr.puts "Issue loading custom defaults. #{e.message}\n#{e.backtrace}"
Thx, I found the root problem, dotfile path is concatenated by ENV['HOME']
and .aprc
, but in my environment, ENV['HOME']
is nil
, so the File.join
raised an exception.
Is this fixed? There can be situations when ENV['HOME'] is not set. Is it possible to guard against this?
Yeah, I just pushed up a commit that resolves this. Thanks!
awesome_thanks!
Error still there in 1.8.0
Heads up for others encountering this problem with awesome_print
on Rails: if you see this error message, it's because your app's ENV['HOME']
has disappeared. The easiest fix here is to fix that. In my case awesome_print
failed with this error because we had rspec specs using stub_const
to stub ENV
values in tests:
# rspec test ...
before do
stub_const("ENV", {
"API_ENABLED" => true
})
end
This stub quietly erased our app's environment variables -- including ENV['HOME']
set by rails, which awesome_print
needed to pry into tests. We fixed it by stubbing our environment variables in a way that didn't modify the environmental variables set by rails.
The current unreleased master
branch of awesome_print
past 1.8.0
has code that prevents this error from breaking pry.. but when my HOME env was still missing it just gave me nicely formatted code... without any colour. I'm staying on 1.8.0
for now.
I'm using
logstash@5.5.0
which usedawesome_print
as a dependency, when I run logstash, it raised an error:I have checked my
inspector.rb
Line 163, it is https://github.com/awesome-print/awesome_print/blob/master/lib/awesome_print/inspector.rb#L164I'm not familiar with ruby, if there is no
.aprc
file or it is not readable,#{dotfile}
could be undefined ?