Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change the exception name to HomeAssistantError #124

Merged
merged 1 commit into from
Jan 5, 2023
Merged

Conversation

leranp
Copy link
Contributor

@leranp leranp commented Dec 20, 2022

this will allow HA to use the continue on error in the automation and scripts,
now we can not use the "continue on error" and when the the bridge is busy and return 503 code.

ConnectionError: Http response for http://xx.xxx.xx.xx:8080/lockAction?token=HXXXXXXXX&action=3&nukiId=XXXXXXX&deviceType=4: 503 Service Unavailable

in HA there is a "if" function that only allow HomeAssistant Error to continue on error

        # Only Home Assistant errors and can be ignored.
        if not isinstance(exception, exceptions.HomeAssistantError):
            raise exception

this will allow HA to use the continue on error in the automation and scripts
@kvj
Copy link
Owner

kvj commented Jan 5, 2023

That's a pretty cool improvement, thanks!

@kvj kvj merged commit e6cc5ee into kvj:main Jan 5, 2023
@alexdelprete
Copy link
Contributor

in HA there is a "if" function that only allow HomeAssistant Error to continue on error

this is excellent to better manage the limitations of the bridge. has this been introduced recently in HA? I'm thinking about the minimum version requirement for HA...

@leranp
Copy link
Contributor Author

leranp commented Jan 5, 2023

Please check if this change is working. I think there's an error when the log function is triggered.
I am not a developer :-)

@alexdelprete
Copy link
Contributor

The only real developer here is @kvj :D

@enkama
Copy link
Contributor

enkama commented Jan 5, 2023

2023-01-05 21:46:07.421 ERROR (MainThread) [custom_components.nuki_ng.nuki] Failed to get latest data: name 'HomeAssistantError' is not defined
Traceback (most recent call last):
  File "/config/custom_components/nuki_ng/nuki.py", line 423, in _update
    item["last_log"] = await self.api.web_get_last_unlock_log(web_id)
  File "/config/custom_components/nuki_ng/nuki.py", line 200, in web_get_last_unlock_log
    response = await self.web_async_json(
  File "/config/custom_components/nuki_ng/nuki.py", line 184, in web_async_json
    return await self.async_json(
  File "/config/custom_components/nuki_ng/nuki.py", line 39, in async_json
    raise HomeAssistantError(f"Http response for {response.request.url}: {response.status_code} {response.reason}")
NameError: name 'HomeAssistantError' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/config/custom_components/nuki_ng/nuki.py", line 424, in _update
    except HomeAssistantError:
NameError: name 'HomeAssistantError' is not defined

@enkama
Copy link
Contributor

enkama commented Jan 6, 2023

Makes an error @alexdelprete @leranp @kvj

@leranp
Copy link
Contributor Author

leranp commented Jan 7, 2023

Makes an error @alexdelprete @leranp @kvj
@kvj @alexdelprete @Wibias
#130
please report back if it working now
I have check with my HA and it looks fine

@kvj
Copy link
Owner

kvj commented Jan 7, 2023

merged

@leranp
Copy link
Contributor Author

leranp commented Jan 7, 2023

merged

Did you check if it was working?

@enkama
Copy link
Contributor

enkama commented Jan 7, 2023

Yup thats working. Just throwing the old homeassistant.exceptions.HomeAssistantError: Http response for https://api.nuki.io/smartlock/*****/log: 500 Server and Despite being configured, Web API request has failed error now.

Getting spammed a bit to much tbh so its a must for me to add custom_components.nuki_ng.nuki: critical

@leranp
Copy link
Contributor Author

leranp commented Jan 7, 2023

Yup thats working. Just throwing the old homeassistant.exceptions.HomeAssistantError: Http response for https://api.nuki.io/smartlock/*****/log: 500 Server and Despite being configured, Web API request has failed error now.

Getting spammed a bit to much tbh so its a must for me to add custom_components.nuki_ng.nuki: critical

Tomorrow i will take a look and see if there's an option to make it look better ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants