Also generate error when autogenerating stack traces (fix #25)

R=jakemac@google.com

Review URL: https://codereview.chromium.org//1284983004 .
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b0b759e..d04354d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.11.1+1
+
+* Include default error with the auto-generated stack traces.
+
 ## 0.11.1
 
 * Add support for automatically logging the stack trace on error messages. Note
diff --git a/lib/logging.dart b/lib/logging.dart
index c8417fc..f1641dc 100644
--- a/lib/logging.dart
+++ b/lib/logging.dart
@@ -160,6 +160,7 @@
           throw "autogenerated stack trace for $logLevel $message";
         } catch (e, t) {
           stackTrace = t;
+          if (error == null) error = e;
         }
       }
       if (zone == null) zone = Zone.current;
diff --git a/pubspec.yaml b/pubspec.yaml
index 1236b30..2206dbe 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: logging
-version: 0.11.1
+version: 0.11.1+1
 author: Dart Team <misc@dartlang.org>
 description: >
   Provides APIs for debugging and error logging. This library introduces
diff --git a/test/logging_test.dart b/test/logging_test.dart
index e27ee2f..60017b3 100644
--- a/test/logging_test.dart
+++ b/test/logging_test.dart
@@ -569,5 +569,18 @@
       expect(records[0].stackTrace, isNot(equals(trace)));
       expect(records[1].stackTrace, trace);
     });
+
+    test('error also generated when generating a trace', () {
+      var records = new List<LogRecord>();
+      recordStackTraceAtLevel = Level.WARNING;
+      root.onRecord.listen(records.add);
+      root.severe('hello');
+      root.warning('hello');
+      root.info('hello');
+      expect(records, hasLength(3));
+      expect(records[0].error, isNotNull);
+      expect(records[1].error, isNotNull);
+      expect(records[2].error, isNull);
+    });
   });
 }