41ec4ad32b10ab5efc1d63f00cd1a6eb0607791e
[platform/framework/web/crosswalk.git] / src / xwalk / app / android / runtime_client / src / org / xwalk / app / runtime / XWalkRuntimeLibraryException.java
1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.xwalk.app.runtime;
6
7 /**
8  * This class is to consolidate the exceptions happen when
9  * the runtime client is trying to invoke runtime library
10  * through reflection.
11  * 
12  * The exception will be set different label to identify which
13  * stage the exception happened in.
14  *
15  * The exception handler for the runtime client will take
16  * different action based on the type of the exception.
17  */
18 public class XWalkRuntimeLibraryException extends Exception {
19     public final static int XWALK_RUNTIME_LIBRARY_NOT_INSTALLED = 1;
20     public final static int XWALK_RUNTIME_LIBRARY_NOT_UP_TO_DATE_CRITICAL = 2;
21     public final static int XWALK_RUNTIME_LIBRARY_NOT_UP_TO_DATE_WARNING = 3;
22     public final static int XWALK_CORE_LIBRARY_SO_NOT_EXIST = 4;
23     public final static int XWALK_RUNTIME_LIBRARY_INVOKE_FAILED = 5;
24     
25     private int mType;
26     private Exception mOriginException;
27     
28     XWalkRuntimeLibraryException(int type, Exception originException) {
29         mType = type;
30         mOriginException = originException;
31     }
32     
33     XWalkRuntimeLibraryException(int type) {
34         mType = type;
35         mOriginException = null;
36     }
37     
38     XWalkRuntimeLibraryException() {
39         mType = XWALK_RUNTIME_LIBRARY_NOT_INSTALLED;
40         mOriginException = null;
41     }
42     
43     public int getType() {
44         return mType;
45     }
46     
47     public Exception getOriginException() {
48         return mOriginException;
49     }
50 }