javaextensions/globalindicators/javasrc/com/nokia/mid/ui/GlobalIndicatorsException.java
changeset 78 71ad690e91f5
parent 72 1f0034e370aa
child 80 d6dafc5d983f
equal deleted inserted replaced
72:1f0034e370aa 78:71ad690e91f5
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Exception for Global Indicators
       
    15  *
       
    16 */
       
    17 
       
    18 package com.nokia.mid.ui;
       
    19 
       
    20 public class GlobalIndicatorsException extends Exception
       
    21 {
       
    22 
       
    23 
       
    24     private int errorCode;
       
    25 
       
    26     /**
       
    27      * Default constructor is not allowed.
       
    28      */
       
    29     protected GlobalIndicatorsException() {}
       
    30 
       
    31     /**
       
    32      * Constructs an exception instance with a textual information.
       
    33      * @param info human readable information about the exception.
       
    34      */
       
    35     public GlobalIndicatorsException(String info)
       
    36     {
       
    37         super(info);
       
    38     }
       
    39 
       
    40     /**
       
    41      * Constructs an exception instance with a textual information and the
       
    42      * error code of the native call.
       
    43      * @param info human readable information about the exception.
       
    44      * @param errorCode the error code received from native side.
       
    45      */
       
    46     public GlobalIndicatorsException(String info, int errorCode)
       
    47     {
       
    48         super(info);
       
    49         this.errorCode = errorCode;
       
    50     }
       
    51 
       
    52     /**
       
    53      * Constructs human readable textual information
       
    54      * @return String the human readable textual information
       
    55      */
       
    56     public String toString()
       
    57     {
       
    58         if (errorCode == 0)
       
    59         {
       
    60             return super.toString();
       
    61         }
       
    62         else
       
    63         {
       
    64             return super.toString() + " Native error: " + errorCode;
       
    65         }
       
    66     }
       
    67 
       
    68     /**
       
    69      * Returns the native error code
       
    70      * @return the native error code
       
    71      */
       
    72     public int getErrorCode()
       
    73     {
       
    74         return errorCode;
       
    75     }
       
    76 }