describeLiveError function

String describeLiveError(
  1. Object error
)

A user-facing message for an error raised while running a live command.

Implementation

String describeLiveError(Object error) {
  if (error is JsonRpcException) return error.details;
  if (error is LiveCommandException) return error.message;
  if (error is LiveDiscoveryException) return error.message;
  if (error is TimeoutException) {
    return 'The app didn\'t respond in time. It may be paused in a debugger '
        'or in the background.';
  }
  if (error is JsonRpcConnectionClosed) {
    return 'Lost the connection to the app. Did it stop running?';
  }
  if (error is FormatException) return error.message;
  return '$error';
}