test_class.file: shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLErrPacketFactoryTest.java
test_class.identifier: MySQLErrPacketFactoryTest
test_case.body: @Test
      public void assertNewInstanceWithSQLParsingException() {
          assertCommonException(MySQLErrPacketFactory.newInstance(new SQLParsingException("No reason")));
      }
test_case.class_method_signature: MySQLErrPacketFactoryTest.assertNewInstanceWithSQLParsingException()
test_case.full_signature: @Test public void assertNewInstanceWithSQLParsingException()
test_case.identifier: assertNewInstanceWithSQLParsingException
test_case.invocations: assertCommonException newInstance
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void assertNewInstanceWithSQLParsingException()
focal_class.file: shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLErrPacketFactory.java
focal_class.identifier: MySQLErrPacketFactory
focal_class.class_method_signature: MySQLErrPacketFactory.newInstance(final Exception cause)
focal_class.full_signature: public static MySQLErrPacket newInstance(final Exception cause)
focal_class.identifier: newInstance
focal_class.modifiers: public static
focal_class.parameters: (final Exception cause)
focal_class.return: MySQLErrPacket
focal_class.signature: MySQLErrPacket newInstance(final Exception cause)
focal_method.body: public static MySQLErrPacket newInstance(final Exception cause) {
          if (cause instanceof SQLException) {
              SQLException sqlException = (SQLException) cause;
              return null != sqlException.getSQLState() ? new MySQLErrPacket(1, sqlException.getErrorCode(), sqlException.getSQLState(), sqlException.getMessage())
                  : new MySQLErrPacket(1, MySQLServerErrorCode.ER_INTERNAL_ERROR, cause.getMessage());
          }
          if (cause instanceof ShardingCTLException) {
              ShardingCTLException shardingCTLException = (ShardingCTLException) cause;
              return new MySQLErrPacket(1, ShardingCTLErrorCode.valueOf(shardingCTLException), shardingCTLException.getShardingCTL());
          }
          if (cause instanceof TableModifyInTransactionException) {
              return new MySQLErrPacket(1, MySQLServerErrorCode.ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE, ((TableModifyInTransactionException) cause).getTableName());
          }
          if (cause instanceof UnknownDatabaseException) {
              return new MySQLErrPacket(1, MySQLServerErrorCode.ER_BAD_DB_ERROR, ((UnknownDatabaseException) cause).getDatabaseName());
          }
          if (cause instanceof NoDatabaseSelectedException) {
              return new MySQLErrPacket(1, MySQLServerErrorCode.ER_NO_DB_ERROR);
          }
          if (cause instanceof DBCreateExistsException) {
              return new MySQLErrPacket(1, MySQLServerErrorCode.ER_DB_CREATE_EXISTS_ERROR, ((DBCreateExistsException) cause).getDatabaseName());
          }
          if (cause instanceof DBDropExistsException) {
              return new MySQLErrPacket(1, MySQLServerErrorCode.ER_DB_DROP_EXISTS_ERROR, ((DBDropExistsException) cause).getDatabaseName());
          }
          if (cause instanceof TableExistsException) {
              return new MySQLErrPacket(1, MySQLServerErrorCode.ER_TABLE_EXISTS_ERROR, ((TableExistsException) cause).getTableName());
          }
          if (cause instanceof CircuitBreakException) {
              return new MySQLErrPacket(1, CommonErrorCode.CIRCUIT_BREAK_MODE);
          }
          if (cause instanceof UnsupportedCommandException) {
              return new MySQLErrPacket(1, CommonErrorCode.UNSUPPORTED_COMMAND, ((UnsupportedCommandException) cause).getCommandType());
          }
          if (cause instanceof UnsupportedPreparedStatementException) {
              return new MySQLErrPacket(1, MySQLServerErrorCode.ER_UNSUPPORTED_PS);
          }
          if (cause instanceof ShardingSphereConfigurationException || cause instanceof SQLParsingException) {
              return new MySQLErrPacket(1, MySQLServerErrorCode.ER_NOT_SUPPORTED_YET, cause.getMessage());
          }
          if (cause instanceof RuleNotExistsException) {
              return new MySQLErrPacket(1, MySQLServerErrorCode.ER_SP_DOES_NOT_EXIST);
          }
          return new MySQLErrPacket(1, CommonErrorCode.UNKNOWN_EXCEPTION, cause.getMessage());
      }
focal_method.class_method_signature: MySQLErrPacketFactory.newInstance(final Exception cause)
focal_method.full_signature: public static MySQLErrPacket newInstance(final Exception cause)
focal_method.identifier: newInstance
focal_method.invocations: getSQLState getErrorCode getSQLState getMessage getMessage valueOf getShardingCTL getTableName getDatabaseName getDatabaseName getDatabaseName getTableName getCommandType getMessage getMessage
focal_method.modifiers: public static
focal_method.parameters: (final Exception cause)
focal_method.return: MySQLErrPacket
focal_method.signature: MySQLErrPacket newInstance(final Exception cause)