sendError method

void sendError(
  1. ErrorType type,
  2. int callbackId,
  3. int errorCode, [
  4. String? errorMessage,
])

Implementation

void sendError(ErrorType type, int callbackId, int errorCode,
    [String? errorMessage]) {
  var msg = DC.stringToBytes(errorMessage ?? "");
  if (type == ErrorType.Management)
    sendParams()
      ..addUint8(0xC0 | IIPPacketReport.ManagementError)
      ..addUint32(callbackId)
      ..addUint16(errorCode)
      ..done();
  else if (type == ErrorType.Exception)
    sendParams()
      ..addUint8(0xC0 | IIPPacketReport.ExecutionError)
      ..addUint32(callbackId)
      ..addUint16(errorCode)
      ..addUint16(msg.length)
      ..addDC(msg)
      ..done();
}