From 9b7cffb553ba1154d127d6695550c5ad8125a5fc Mon Sep 17 00:00:00 2001
From: "nweiz@google.com" <nweiz@google.com>
Date: Thu, 24 Jul 2014 02:22:36 +0000
Subject: [PATCH] Reference SourceSpanException as well as SpanException in
 pub.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org//418783003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@38533 260f80e4-7a28-3924-810f-c04153c831b5
---
 lib/src/log.dart | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/src/log.dart b/lib/src/log.dart
index 68215810..3eb25573 100644
--- a/lib/src/log.dart
+++ b/lib/src/log.dart
@@ -11,6 +11,7 @@ import 'dart:io';
 
 import 'package:path/path.dart' as p;
 import 'package:source_maps/source_maps.dart';
+import 'package:source_span/source_span.dart';
 import 'package:stack_trace/stack_trace.dart';
 
 import 'exceptions.dart';
@@ -317,6 +318,8 @@ void exception(exception, [StackTrace trace]) {
   // spew a stack trace on our users.
   if (exception is SpanException) {
     error(exception.toString(useColors: canUseSpecialChars));
+  } else if (exception is SourceSpanException) {
+    error(exception.toString(color: canUseSpecialChars));
   } else {
     error(getErrorMessage(exception));
   }
@@ -507,7 +510,8 @@ class _JsonLogger {
     }
 
     // If the error came from a file, include the path.
-    if (error is SpanException && error.span.sourceUrl != null) {
+    if ((error is SpanException || error is SourceSpanException) &&
+        error.span.sourceUrl != null) {
       errorJson["path"] = p.fromUri(error.span.sourceUrl);
     }
 
-- 
GitLab