|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.mid.ui; |
|
19 |
|
20 public class SoftNotificationException extends Exception |
|
21 { |
|
22 |
|
23 |
|
24 private int errorCode; |
|
25 |
|
26 /** |
|
27 * Default constructor is not allowed. |
|
28 */ |
|
29 protected SoftNotificationException() {} |
|
30 |
|
31 /** |
|
32 * Constructs an exception instance with a textual information. |
|
33 * |
|
34 * @param info human readable information about the exception. |
|
35 */ |
|
36 public SoftNotificationException(String info) |
|
37 { |
|
38 super(info); |
|
39 } |
|
40 |
|
41 /** |
|
42 * Constructs an exception instance with a textual information and the |
|
43 * error code of the native call. |
|
44 * |
|
45 * @param info human readable information about the exception. |
|
46 * @param errorCode the error code received from native side. |
|
47 */ |
|
48 public SoftNotificationException(String info, int errorCode) |
|
49 { |
|
50 super(info); |
|
51 this.errorCode = errorCode; |
|
52 } |
|
53 |
|
54 /** |
|
55 * Constructs human readable textual information. |
|
56 * |
|
57 * @return String the human readable textual information. |
|
58 */ |
|
59 public String toString() |
|
60 { |
|
61 if (errorCode == 0) |
|
62 { |
|
63 return super.toString(); |
|
64 } |
|
65 else |
|
66 { |
|
67 return super.toString() + " Native error: " + errorCode; |
|
68 } |
|
69 } |
|
70 |
|
71 /** |
|
72 * Returns with the native error code. |
|
73 * |
|
74 * @return Native error code. |
|
75 */ |
|
76 public int getErrorCode() |
|
77 { |
|
78 return errorCode; |
|
79 } |
|
80 } |