docs: public static DatabaseException toDatabaseException(Exception ex)
      {
          if (ex instanceof DatabaseException)
              return (DatabaseException)ex;
          int iErrorCode = DBConstants.ERROR_STRING;
          if (ex instanceof DBException)
              iErrorCode = ((DBException)ex).getErrorCode();
          String strMessage = ex.getMessage();
          if (strMessage != null)
              if (strMessage.startsWith(DBEXCEPTION_TEXT))
          {
              int iNextPos = strMessage.indexOf(' ', DBEXCEPTION_TEXT.length());
              if (iNextPos != -1)
              {
                  iErrorCode = Integer.parseInt(strMessage.substring(DBEXCEPTION_TEXT.length(), iNextPos));
                  if (iNextPos + 1 < strMessage.length())
                      strMessage = strMessage.substring(iNextPos + 1);
              }
          }
          return new DatabaseException(iErrorCode, strMessage);
      }