private static String limitErrorMessage(@NotNull String message){
  int offset=StringUtil.lineColToOffset(message,30,0);
  if (offset < 0) {
    offset=message.length();
  }
  return message.substring(0,Math.min(offset,1024));
}

private static String limitErrorMessage ( @ NotNull String message ) { int offset = StringUtil . lineColToOffset ( message , 30 , 0 ) ; if ( offset < 0 ) { offset = message . length ( ) ; } return message . substring ( 0 , Math . min ( offset , 1024 ) ) ; }
limit the error message retrieved from the emulator to the smaller of 1k characters or 30 lines .
