... | ... |
@@ -5,7 +5,13 @@ module Rubysermon |
5 | 5 |
|
6 | 6 |
def initialize(config_path) |
7 | 7 |
raw_json = File.read(config_path) |
8 |
- @parsed_settings = JSON.parse(raw_json, symbolize_names: true) |
|
8 |
+ |
|
9 |
+ begin |
|
10 |
+ @parsed_settings = JSON.parse(raw_json, symbolize_names: true) |
|
11 |
+ rescue JSON::ParserError |
|
12 |
+ @parsed_settings = {} |
|
13 |
+ $stderr.puts "Invalid JSON file" |
|
14 |
+ end |
|
9 | 15 |
end |
10 | 16 |
|
11 | 17 |
def get_settings |