kellerza / pysma

Async library for SMA Solar's WebConnect interface
MIT License
59 stars 51 forks source link

Add exceptions and restructure _fetch_json #68

Closed rklomp closed 3 years ago

rklomp commented 3 years ago

Add exceptions. All methods should return a valid value. If not, an exception should be raise. These exceptions can be handled in HA to more easily provide feedback when things go wrong during setup or polling of data.

Also _fetch_json has been renamed to _post_json and new method _get_json was added. These both call _request_json.

codecov[bot] commented 3 years ago

Codecov Report

Merging #68 (41fb89b) into master (9953118) will increase coverage by 2.22%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #68      +/-   ##
==========================================
+ Coverage   93.47%   95.69%   +2.22%     
==========================================
  Files           5        6       +1     
  Lines         383      395      +12     
==========================================
+ Hits          358      378      +20     
+ Misses         25       17       -8     
Impacted Files Coverage Δ
pysma/__init__.py 90.47% <100.00%> (+5.38%) :arrow_up:
pysma/const.py 100.00% <100.00%> (ø)
pysma/exceptions.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9953118...41fb89b. Read the comment docs.