Skip to content

Commit 396b5fb

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Report issues with loading summaries using LibraryCycleLinkException.
...so that we can include additional data as a "file". The exception text has smaller size limit than we need. Change-Id: I56ff7f7a85658419aa360bd6ab48b55fd180bfe5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148794 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
1 parent d307e6d commit 396b5fb

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

pkg/analyzer/lib/src/dart/analysis/library_context.dart

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,18 @@ class LibraryContext {
166166
var existingSource = existingElement?.source;
167167
var libraryRefs = elementFactory.rootReference.children;
168168
var libraryUriList = libraryRefs.map((e) => e.name).toList();
169-
throw StateError(
170-
'[The library is already loaded]'
171-
'[oldUri: ${existingSource.uri}]'
172-
'[oldPath: ${existingSource.fullName}]'
173-
'[newUri: ${libraryFile.uriStr}]'
174-
'[newPath: ${libraryFile.path}]'
175-
'[cycle: $cycle]'
176-
'[loadedBundles: ${loadedBundles.toList()}]'
177-
'[elementFactory.libraries: $libraryUriList]',
169+
var statusText = '[The library is already loaded]'
170+
'[oldUri: ${existingSource.uri}]'
171+
'[oldPath: ${existingSource.fullName}]'
172+
'[newUri: ${libraryFile.uriStr}]'
173+
'[newPath: ${libraryFile.path}]'
174+
'[cycle: $cycle]'
175+
'[loadedBundles: ${loadedBundles.toList()}]'
176+
'[elementFactory.libraries: $libraryUriList]';
177+
throw LibraryCycleLinkException(
178+
'Cycle loading state error',
179+
StackTrace.current,
180+
{'status': statusText},
178181
);
179182
}
180183
}

0 commit comments

Comments
 (0)