We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b0d8778 commit b7b96f6Copy full SHA for b7b96f6
commitizen/config/json_config.py
@@ -1,6 +1,7 @@
1
import json
2
from pathlib import Path
3
from typing import Union
4
+from commitizen.exceptions import InvalidConfigurationError
5
6
from commitizen.git import smart_open
7
@@ -11,8 +12,8 @@ class JsonConfig(BaseConfig):
11
12
def __init__(self, *, data: Union[bytes, str], path: Union[Path, str]):
13
super(JsonConfig, self).__init__()
14
self.is_empty_config = False
- self._parse_setting(data)
15
self.add_path(path)
16
+ self._parse_setting(data)
17
18
def init_empty_config_content(self):
19
with smart_open(self.path, "a") as json_file:
@@ -43,7 +44,11 @@ def _parse_setting(self, data: Union[bytes, str]) -> None:
43
44
}
45
```
46
"""
- doc = json.loads(data)
47
+ try:
48
+ doc = json.loads(data)
49
+ except json.JSONDecodeError:
50
+ raise InvalidConfigurationError(f"Failed to parse {self.path}")
51
+
52
try:
53
self.settings.update(doc["commitizen"])
54
except KeyError:
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments