Update change log and spec for wrt-plugins-tizen_0.4.13
[framework/web/wrt-plugins-tizen.git] / src / Common / PlatformException.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18
19 #ifndef _PLATFORM_EXCEPTION_H_
20 #define _PLATFORM_EXCEPTION_H_
21
22 #include <string>
23 #include <JavaScriptCore/JavaScript.h>
24
25
26 namespace DeviceAPI {
27 namespace Common{
28
29 class BasePlatformException{
30 public:
31     BasePlatformException(int code, const char* name, const char* message);
32     BasePlatformException(JSContextRef ctx, JSValueRef exception);
33
34     virtual int getCode() const;
35     virtual std::string getName() const;
36     virtual std::string getMessage() const;
37
38 protected:
39     int mCode;
40     std::string mName;
41     std::string mMessage;
42 };
43
44 class TypeMismatchException : public BasePlatformException{
45 public:
46     TypeMismatchException(const char* message);
47     TypeMismatchException(JSContextRef ctx, JSValueRef exception);
48 };
49
50
51 class InvalidValuesException : public BasePlatformException{
52 public:
53     InvalidValuesException(const char* message);
54     InvalidValuesException(JSContextRef ctx, JSValueRef exception);
55 };
56
57
58 class IOException : public BasePlatformException{
59 public:
60     IOException(const char* message);
61     IOException(JSContextRef ctx, JSValueRef exception);
62 };
63
64
65 class UnknownException : public BasePlatformException{
66 public:
67     UnknownException(const char* message);
68     UnknownException(JSContextRef ctx, JSValueRef exception);
69 };
70
71 class ServiceNotAvailableException : public BasePlatformException{
72 public:
73     ServiceNotAvailableException(const char* message);
74     ServiceNotAvailableException(JSContextRef ctx, JSValueRef exception);
75 };
76
77 class SecurityException : public BasePlatformException{
78 public:
79     SecurityException(const char* message);
80     SecurityException(JSContextRef ctx, JSValueRef exception);
81 };
82
83 class NotSupportedException : public BasePlatformException{
84 public:
85     NotSupportedException(const char* message);
86     NotSupportedException(JSContextRef ctx, JSValueRef exception);
87 };
88
89 class NotFoundException : public BasePlatformException{
90 public:
91     NotFoundException(const char* message);
92     NotFoundException(JSContextRef ctx, JSValueRef exception);
93 };
94
95
96
97
98
99 }}
100
101
102 #endif //_PLATFORM_EXCEPTION_H_
103