mirror of
https://github.com/meineerde/dotfiles.git
synced 2026-02-23 03:51:44 +00:00
Nicer errors if json couldn't be parsed
This commit is contained in:
parent
e664bba35e
commit
f6a8b7765c
7
bin/json
7
bin/json
@ -14,7 +14,12 @@ else
|
|||||||
data = STDIN.read
|
data = STDIN.read
|
||||||
end
|
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')
|
if ARGV.include?('--color')
|
||||||
require 'ap'
|
require 'ap'
|
||||||
ap json
|
ap json
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user