emitError method

void emitError(
  1. ErrorType type,
  2. dynamic error
)

Implementation

void emitError(ErrorType /*ErrorType */ type, dynamic error) {
  print('Error: $error'); // Replace with logger.error in your actual code
  try {
    String errorString = "";
    if (error is PeerErrorType) {
      errorString = error.value;
    } else if (error is String) {
      errorString = error;
    } else {
      errorString = error.toString();
    }
    emit('error', PeerError<ErrorType>(type, errorString).toString());
  } catch (err, stack) {
    print(err);
  }
}