Config should be validated with clearer errors
還沒有人認領這個 Issue。
評估
研究方向
從 mautrix/util/config.py 開始,特別查看 _recursive_get,以及 mautrix_telegram/config.py,其中 bridge.filter.mode 會在設定期間被複製。重現報告中所示的啟動失敗,並讓無效的巢狀設定產生能指出問題的錯誤,而不是 NoneType traceback。
由索引模型根據 Issue 內容生成。
描述
This doesn't tell me what is wrong:
Feb 3 10:15:20 integrations systemd[1]: Started Telegram Bridge.
Feb 3 10:15:22 integrations python[16389]: Traceback (most recent call last):
Feb 3 10:15:22 integrations python[16389]: File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
Feb 3 10:15:22 integrations python[16389]: "__main__", mod_spec)
Feb 3 10:15:22 integrations python[16389]: File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
Feb 3 10:15:22 integrations python[16389]: exec(code, run_globals)
Feb 3 10:15:22 integrations python[16389]: File "/home/telegram/tgenv/lib/python3.6/site-packages/mautrix_telegram/__main__.py", line 113, in <module>
Feb 3 10:15:22 integrations python[16389]: TelegramBridge().run()
Feb 3 10:15:22 integrations python[16389]: File "/home/telegram/tgenv/lib/python3.6/site-packages/mautrix/bridge/bridge.py", line 92, in run
Feb 3 10:15:22 integrations python[16389]: self._prepare()
Feb 3 10:15:22 integrations python[16389]: File "/home/telegram/tgenv/lib/python3.6/site-packages/mautrix/bridge/bridge.py", line 99, in _prepare
Feb 3 10:15:22 integrations python[16389]: self.prepare_config(args.config, args.registration, args.base_config)
Feb 3 10:15:22 integrations python[16389]: File "/home/telegram/tgenv/lib/python3.6/site-packages/mautrix/bridge/bridge.py", line 122, in prepare_config
Feb 3 10:15:22 integrations python[16389]: self.config.update()
Feb 3 10:15:22 integrations python[16389]: File "/home/telegram/tgenv/lib/python3.6/site-packages/mautrix/util/config.py", line 152, in update
Feb 3 10:15:22 integrations python[16389]: self.do_update(ConfigUpdateHelper(base, self))
Feb 3 10:15:22 integrations python[16389]: File "/home/telegram/tgenv/lib/python3.6/site-packages/mautrix_telegram/config.py", line 146, in do_update
Feb 3 10:15:22 integrations python[16389]: copy("bridge.filter.mode")
Feb 3 10:15:22 integrations python[16389]: File "/home/telegram/tgenv/lib/python3.6/site-packages/mautrix/util/config.py", line 112, in copy
Feb 3 10:15:22 integrations python[16389]: if from_path in self.source:
Feb 3 10:15:22 integrations python[16389]: File "/home/telegram/tgenv/lib/python3.6/site-packages/mautrix/util/config.py", line 57, in __contains__
Feb 3 10:15:22 integrations python[16389]: return self.get(key, None) is not None
Feb 3 10:15:22 integrations python[16389]: File "/home/telegram/tgenv/lib/python3.6/site-packages/mautrix/util/config.py", line 50, in get
Feb 3 10:15:22 integrations python[16389]: return self._recursive_get(self._data, key, default_value)
Feb 3 10:15:22 integrations python[16389]: File "/home/telegram/tgenv/lib/python3.6/site-packages/mautrix/util/config.py", line 45, in _recursive_get
Feb 3 10:15:22 integrations python[16389]: return self._recursive_get(next_data, next_key, default_value)
Feb 3 10:15:22 integrations python[16389]: File "/home/telegram/tgenv/lib/python3.6/site-packages/mautrix/util/config.py", line 45, in _recursive_get
Feb 3 10:15:22 integrations python[16389]: return self._recursive_get(next_data, next_key, default_value)
Feb 3 10:15:22 integrations python[16389]: File "/home/telegram/tgenv/lib/python3.6/site-packages/mautrix/util/config.py", line 46, in _recursive_get
Feb 3 10:15:22 integrations python[16389]: return data.get(key, default_value)
Feb 3 10:15:22 integrations python[16389]: AttributeError: 'NoneType' object has no attribute 'get'
Feb 3 10:15:22 integrations systemd[1]: telegram.service: Main process exited, code=exited, status=1/FAILURE
- 主要語言
- Python
- 星號
- 249
- 分支
- 84
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
mautrix/python 的其他 Issue
-
難度 5/5 一週以上 新手友好度 30/100
-
bug
難度 2/5 1-3 小時 新手友好度 45/100
-
難度 5/5 一週以上 新手友好度 25/100
-
難度 4/5 3-5 天 新手友好度 30/100
-
難度 4/5 3-5 天 新手友好度 35/100
相似的 Issue
-
documentation help wanted
難度 2/5 1-3 小時 新手友好度 90/100
-
難度 2/5 1-3 小時 新手友好度 90/100
simonw/sqlite-utils#872 ·
-
難度 2/5 1-3 小時 新手友好度 88/100
-
難度 2/5 1-3 小時 新手友好度 82/100
-
難度 2/5 1-3 小時 新手友好度 78/100