1
0
mirror of https://github.com/meineerde/dotfiles.git synced 2026-02-06 00:53:23 +00:00

Nicer errors if json couldn't be parsed

This commit is contained in:
Holger Just 2013-09-23 16:30:29 +02:00
parent e664bba35e
commit f6a8b7765c

View File

@ -14,7 +14,12 @@ else
data = STDIN.read
end
json = JSON.parse(data)
begin
json = JSON.parse(data)
rescue JSON::ParserError => err
$stderr.puts err.message
exit 1
end
if ARGV.include?('--color')
require 'ap'
ap json