Index: pkg/analysis_server/lib/src/domain_server.dart |
diff --git a/pkg/analysis_server/lib/src/domain_server.dart b/pkg/analysis_server/lib/src/domain_server.dart |
index 1e37f24a69a38d6fdacc023419823dcae5cafa84..3924d1ad31a9fb9e16c37d21b4ee33d891b923b2 100644 |
--- a/pkg/analysis_server/lib/src/domain_server.dart |
+++ b/pkg/analysis_server/lib/src/domain_server.dart |
@@ -109,8 +109,16 @@ class ServerDomainHandler implements RequestHandler { |
AnalysisContext context = AnalysisEngine.instance.createAnalysisContext(); |
// TODO(brianwilkerson) Use the information from the request to set the |
// source factory in the context. |
+ DirectoryBasedDartSdk sdk; |
+ try { |
+ sdk = new DirectoryBasedDartSdk(new JavaFile(sdkDirectory)); |
+ } on Exception catch (e) { |
+ // TODO what error code should be returned here? |
+ return new Response(request.id, new RequestError( |
+ RequestError.CODE_SDK_ERROR, 'Failed to access sdk: $e')); |
+ } |
context.sourceFactory = new SourceFactory.con2([ |
- new DartUriResolver(new DirectoryBasedDartSdk(new JavaFile(sdkDirectory))), |
+ new DartUriResolver(sdk), |
new FileUriResolver(), |
// new PackageUriResolver(), |
]); |