mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:49:00 +00:00
[dds] Handle methodNotFound errors for setLibraryDebuggable for DWDS
DWDS doesn't currently support this so the unhandled error will terminate the DAP when running under Flutter web: https://github.com/dart-lang/webdev/issues/606 Change-Id: I14f2dbffca66244268802924e347e2d70eec30a5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248124 Commit-Queue: Ben Konyi <bkonyi@google.com> Reviewed-by: Ben Konyi <bkonyi@google.com>
This commit is contained in:
parent
40e25ebad0
commit
3056251f90
1 changed files with 17 additions and 1 deletions
|
@ -10,6 +10,7 @@ import 'package:collection/collection.dart';
|
|||
import 'package:path/path.dart' as path;
|
||||
import 'package:vm_service/vm_service.dart' as vm;
|
||||
|
||||
import '../rpc_error_codes.dart';
|
||||
import 'adapters/dart.dart';
|
||||
import 'exceptions.dart';
|
||||
import 'protocol_generated.dart';
|
||||
|
@ -694,7 +695,22 @@ class IsolateManager {
|
|||
final isDebuggable = libraryUri != null
|
||||
? await _adapter.libraryIsDebuggable(thread, Uri.parse(libraryUri))
|
||||
: false;
|
||||
await service.setLibraryDebuggable(isolateId, library.id!, isDebuggable);
|
||||
try {
|
||||
await service.setLibraryDebuggable(
|
||||
isolateId, library.id!, isDebuggable);
|
||||
} on vm.RPCError catch (e) {
|
||||
// DWDS does not currently support `setLibraryDebuggable` so instead of
|
||||
// failing (because this code runs in a VM event handler where there's
|
||||
// no incoming request to fail/reject), just log this error.
|
||||
// https://github.com/dart-lang/webdev/issues/606
|
||||
if (e.code == RpcErrorCodes.kMethodNotFound) {
|
||||
_adapter.logger?.call(
|
||||
'setLibraryDebuggable not available ($libraryUri, $e)',
|
||||
);
|
||||
} else {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue