javaextensions/pim/javasrc.s60/com/nokia/mj/impl/pim/utils/NativeError.java
changeset 78 71ad690e91f5
parent 72 1f0034e370aa
equal deleted inserted replaced
72:1f0034e370aa 78:71ad690e91f5
   645         }
   645         }
   646     }
   646     }
   647     public static void handleCreateCalendarError(int aNativeErrorCode, String aCalName) 
   647     public static void handleCreateCalendarError(int aNativeErrorCode, String aCalName) 
   648     throws PIMException
   648     throws PIMException
   649     {
   649     {
   650 
       
   651 
       
   652         if (aNativeErrorCode == OsErrorMessage.SUCCESS)
   650         if (aNativeErrorCode == OsErrorMessage.SUCCESS)
   653         {
   651         {
   654             return; // OK
   652             return; // OK
   655         }
   653         }
   656 
   654 
   668                 "Creation of calendar failed: calendar name is not valid "
   666                 "Creation of calendar failed: calendar name is not valid "
   669                 + aCalName);
   667                 + aCalName);
   670         }
   668         }
   671         case OsErrorMessage.KERR_ALREADY_EXISTS:
   669         case OsErrorMessage.KERR_ALREADY_EXISTS:
   672         {
   670         {
   673              throw new PIMException(ErrorString.CALENDAR_ALREADY_EXISTS, PIMException.GENERAL_ERROR);
   671              throw new PIMException(ErrorString.CALENDAR_ALREADY_EXISTS, aNativeErrorCode);
   674         }
   672         }
   675         default:
   673         default:
   676         {
   674         {
   677             throw new GenericException(ErrorString.GENERAL_ERROR_COLON + aNativeErrorCode);
   675             throw new GenericException(ErrorString.GENERAL_ERROR_COLON + aNativeErrorCode);
   678         }
   676         }
   679         }
   677         }
   680     }
   678     }
   681 
   679 
   682     public static void handleDeleteCalendarError(int aNativeErrorCode, String aCalName)
   680     public static void handleDeleteCalendarError(int aNativeErrorCode, String aCalName) throws PIMException
   683     {
   681     {
   684 
   682 
   685 
   683 
   686         if (aNativeErrorCode == OsErrorMessage.SUCCESS)
   684         if (aNativeErrorCode == OsErrorMessage.SUCCESS)
   687         {
   685         {
   690 
   688 
   691         switch (aNativeErrorCode)
   689         switch (aNativeErrorCode)
   692         {
   690         {
   693         case OsErrorMessage.KERR_ACCESS_DENIED:
   691         case OsErrorMessage.KERR_ACCESS_DENIED:
   694         {
   692         {
   695             throw new IllegalArgumentException(
   693             throw new PIMException("The default calendar cannot be deleted",  aNativeErrorCode);
   696                 "Deletion of calendar failed: phone default calendar cannot be deleted");
       
   697         }
   694         }
   698         case OsErrorMessage.KERR_ARGUMENT:
   695         case OsErrorMessage.KERR_ARGUMENT:
   699         {
   696         {
   700             // we should never end up here since the calendar name is
   697             // we should never end up here since the calendar name is
   701             // verified to be not empty before making   the native call
   698             // verified to be not empty before making   the native call