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

Release v0.2.3 #63

Merged
3 commits merged into from
Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.2.3
This release introduces :
- do not swallow unexpected errors into `FallThroughError` but rather wrap them in a new custom Exception : `OoplaUnexpectedError`
- remove the `is_active` parameter from the transaction for `set_epoch` command

## 0.2.2

This release introduces :
Expand Down
6 changes: 2 additions & 4 deletions lib/src/dooz_gateway.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class DoozGateway {
throw RpcUnknownError(error.code, error.message, data: error.data);
}
} else {
throw FallThroughError();
throw OoplaUnexpectedError(error);
}
}

Expand Down Expand Up @@ -416,8 +416,7 @@ class DoozGateway {
));
}

Future<SetEpochResponse> setEpoch(String address,
{int io = 0, bool isActive = true, int timeout = kScenarioCmdTimeout}) async {
Future<SetEpochResponse> setEpoch(String address, {int io = 0, int timeout = kScenarioCmdTimeout}) async {
_checkValidAddress(address);
final r = Random();
final correlation = int.parse(address, radix: 16) + r.nextInt(1 << 15);
Expand All @@ -431,7 +430,6 @@ class DoozGateway {
'command': 'set epoch',
'correlation': correlation,
'io': io,
'is_active': isActive,
'time_zone': 0, // for now, unused
'epoch': epoch,
},
Expand Down
10 changes: 10 additions & 0 deletions lib/src/exceptions/oopla_errors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,13 @@ class OoplaRequestTimeout implements Exception {

/// This [Exception] should be thrown if a request is called but the socket with ooPLA is not opened.
class OoplaNotConnectedError implements Exception {}

/// This [Exception] should be thrown if a RPC request throws an unexpected error.
class OoplaUnexpectedError implements Exception {
final Object? error;

const OoplaUnexpectedError(this.error);

@override
String toString() => 'OoplaUnexpectedError(error: $error)';
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: dooz_gateway_sdk
description: A Dart SDK to interact with DooZ ooPLA product (IP-BT gateway) and enable control over DooZ mesh n/w
version: 0.2.2
version: 0.2.3
homepage: https://www.dooz-domotique.com/

environment:
Expand Down