Merge pull request #55 from google/0.5.2
rev to publish 0.5.2
diff --git a/changelog.md b/changelog.md
index 1d831f5..5b6c46d 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,9 @@
# webkit_inspection_protocol.dart
+## 0.5.2
+- have `ExceptionDetails` and `WipError` implement `Exception`
+- add `code` and `message` getters to `WipError`
+
## 0.5.1
- add `Runtime.evaluate`
- add `Debugger.setBreakpoint`
diff --git a/lib/src/runtime.dart b/lib/src/runtime.dart
index 2c57014..5fea55b 100644
--- a/lib/src/runtime.dart
+++ b/lib/src/runtime.dart
@@ -138,7 +138,7 @@
new ExceptionDetails(params['exceptionDetails'] as Map<String, dynamic>);
}
-class ExceptionDetails {
+class ExceptionDetails implements Exception {
final Map<String, dynamic> _map;
ExceptionDetails(this._map);
diff --git a/lib/webkit_inspection_protocol.dart b/lib/webkit_inspection_protocol.dart
index cfc4257..6c313f8 100644
--- a/lib/webkit_inspection_protocol.dart
+++ b/lib/webkit_inspection_protocol.dart
@@ -243,7 +243,7 @@
String toString() => 'WipEvent: $method($params)';
}
-class WipError {
+class WipError implements Exception {
final Map<String, dynamic> json;
final int id;
@@ -253,7 +253,11 @@
: id = json['id'] as int,
error = json['error'];
- String toString() => 'WipError $id: $error';
+ int get code => error == null ? null : error['code'];
+
+ String get message => error == null ? null : error['message'];
+
+ String toString() => 'WipError $code $message';
}
class WipResponse {
diff --git a/pubspec.yaml b/pubspec.yaml
index 3824d82..44a9849 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: webkit_inspection_protocol
-version: 0.5.1
+version: 0.5.2
description: A client for the Chrome DevTools Protocol (previously called the Webkit Inspection Protocol).
homepage: https://github.com/google/webkit_inspection_protocol.dart