Skip to content

Commit

Permalink
docs: fix README_zh.md about changelog (#270)
Browse files Browse the repository at this point in the history
fix: error messages and incorrent return value which could possibly lead to crash in mint_storage.py
  • Loading branch information
kekeandzeyu authored Dec 20, 2024
1 parent 640ac25 commit a879ae2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions custom_components/xiaomi_home/miot/miot_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __load(
self, full_path: str, type_: type = bytes, with_hash_check: bool = True
) -> Union[bytes, str, dict, list, None]:
if not os.path.exists(full_path):
_LOGGER.debug('load error, file not exists, %s', full_path)
_LOGGER.debug('load error, file does not exist, %s', full_path)
return None
if not os.access(full_path, os.R_OK):
_LOGGER.error('load error, file not readable, %s', full_path)
Expand Down Expand Up @@ -160,7 +160,7 @@ def __load(
if type_ in [dict, list]:
return json.loads(data_bytes)
_LOGGER.error(
'load error, un-support data type, %s', type_.__name__)
'load error, unsupported data type, %s', type_.__name__)
return None
except (OSError, TypeError) as e:
_LOGGER.error('load error, %s, %s', e, traceback.format_exc())
Expand Down Expand Up @@ -219,8 +219,8 @@ def __save(
w_bytes = json.dumps(data).encode('utf-8')
else:
_LOGGER.error(
'save error, un-support data type, %s', type_.__name__)
return None
'save error, unsupported data type, %s', type_.__name__)
return False
with open(full_path, 'wb') as w_file:
w_file.write(w_bytes)
if with_hash:
Expand Down
2 changes: 1 addition & 1 deletion doc/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ siid、piid、eiid、aiid、value 均为十进制三位整数。

- [许可证](../LICENSE.md)
- 贡献指南: [English](../CONTRIBUTING.md) | [简体中文](./CONTRIBUTING_zh.md)
- [更新日志](./CHANGELOG.md)
- [更新日志](../CHANGELOG.md)
- 开发文档: https://developers.home-assistant.io/docs/creating_component_index

## 目录结构
Expand Down

0 comments on commit a879ae2

Please sign in to comment.