Error Handling - bharat-1809/wizctl GitHub Wiki
Error Handling
All exceptions extend WizException.
try {
await light.turnOn();
} on WizTimeoutError catch (e) {
print('${e.ip} timed out after ${e.retryCount} attempts');
} on WizConnectionError catch (e) {
print('Network error: ${e.cause}');
} on WizResponseError catch (e) {
print('Bad response: ${e.rawResponse}');
}
Exception types
| Exception | Key properties |
|---|---|
WizTimeoutError |
ip, timeout, retryCount |
WizConnectionError |
message, cause |
WizResponseError |
rawResponse, errorCode |
WizMethodNotFoundError |
method, ip — firmware doesn't support this method |
WizArgumentError |
argumentName, invalidValue |
WizUnknownBulbError |
ip — couldn't detect bulb type |