Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
6d4b0abf
Unverified
Commit
6d4b0abf
authored
May 14, 2019
by
Dan Field
Committed by
GitHub
May 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore some JSON RPC errors (#32710)
parent
5f982604
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
driver.dart
packages/flutter_driver/lib/src/driver/driver.dart
+28
-0
dart_vm.dart
...s/fuchsia_remote_debug_protocol/lib/src/dart/dart_vm.dart
+28
-0
No files found.
packages/flutter_driver/lib/src/driver/driver.dart
View file @
6d4b0abf
...
...
@@ -956,7 +956,35 @@ void restoreVmServiceConnectFunction() {
vmServiceConnectFunction
=
_waitAndConnect
;
}
/// The JSON RPC 2 spec says that a notification from a client must not respond
/// to the client. It's possible the client sent a notification as a "ping", but
/// the service isn't set up yet to respond.
///
/// For example, if the client sends a notification message to the server for
/// 'streamNotify', but the server has not finished loading, it will throw an
/// exception. Since the message is a notification, the server follows the
/// specification and does not send a response back, but is left with an
/// unhandled exception. That exception is safe for us to ignore - the client
/// is signaling that it will try again later if it doesn't get what it wants
/// here by sending a notification.
// This may be ignoring too many exceptions. It would be best to rewrite
// the client code to not use notifications so that it gets error replies back
// and can decide what to do from there.
// TODO(dnfield): https://github.com/flutter/flutter/issues/31813
bool
_ignoreRpcError
(
dynamic
error
)
{
if
(
error
is
rpc
.
RpcException
)
{
final
rpc
.
RpcException
exception
=
error
;
return
exception
.
data
==
null
||
exception
.
data
[
'id'
]
==
null
;
}
else
if
(
error
is
String
&&
error
.
startsWith
(
'JSON-RPC error -32601'
))
{
return
true
;
}
return
false
;
}
void
_unhandledJsonRpcError
(
dynamic
error
,
dynamic
stack
)
{
if
(
_ignoreRpcError
(
error
))
{
return
;
}
_log
.
trace
(
'Unhandled RPC error:
\n
$error
\n
$stack
'
);
// TODO(dnfield): https://github.com/flutter/flutter/issues/31813
// assert(false);
...
...
packages/fuchsia_remote_debug_protocol/lib/src/dart/dart_vm.dart
View file @
6d4b0abf
...
...
@@ -31,8 +31,36 @@ typedef RpcPeerConnectionFunction = Future<json_rpc.Peer> Function(
/// custom connection function is needed.
RpcPeerConnectionFunction
fuchsiaVmServiceConnectionFunction
=
_waitAndConnect
;
/// The JSON RPC 2 spec says that a notification from a client must not respond
/// to the client. It's possible the client sent a notification as a "ping", but
/// the service isn't set up yet to respond.
///
/// For example, if the client sends a notification message to the server for
/// 'streamNotify', but the server has not finished loading, it will throw an
/// exception. Since the message is a notification, the server follows the
/// specification and does not send a response back, but is left with an
/// unhandled exception. That exception is safe for us to ignore - the client
/// is signaling that it will try again later if it doesn't get what it wants
/// here by sending a notification.
// This may be ignoring too many exceptions. It would be best to rewrite
// the client code to not use notifications so that it gets error replies back
// and can decide what to do from there.
// TODO(dnfield): https://github.com/flutter/flutter/issues/31813
bool
_ignoreRpcError
(
dynamic
error
)
{
if
(
error
is
json_rpc
.
RpcException
)
{
final
json_rpc
.
RpcException
exception
=
error
;
return
exception
.
data
==
null
||
exception
.
data
[
'id'
]
==
null
;
}
else
if
(
error
is
String
&&
error
.
startsWith
(
'JSON-RPC error -32601'
))
{
return
true
;
}
return
false
;
}
void
_unhandledJsonRpcError
(
dynamic
error
,
dynamic
stack
)
{
if
(
_ignoreRpcError
(
error
))
{
return
;
}
_log
.
fine
(
'Error in internalimplementation of JSON RPC.
\n
$error
\n
$stack
'
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment