8fc5d63ce934f1123506a0e6918b8984912874d1
[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_RUNTIME_LIBRARY_INVOKE_FAILED = 4;
23     
24     private int mType;
25     private Exception mOriginException;
26     
27     XWalkRuntimeLibraryException(int type, Exception originException) {
28         mType = type;
29         mOriginException = originException;
30     }
31     
32     XWalkRuntimeLibraryException(int type) {
33         mType = type;
34         mOriginException = null;
35     }
36     
37     XWalkRuntimeLibraryException() {
38         mType = XWALK_RUNTIME_LIBRARY_NOT_INSTALLED;
39         mOriginException = null;
40     }
41     
42     public int getType() {
43         return mType;
44     }
45     
46     public Exception getOriginException() {
47         return mOriginException;
48     }
49 }