Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / ucb / source / ucp / webdav-neon / DAVException.hxx
blob3e1046ce2b5c624aeda8e064f4e523a5d8125857
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVEXCEPTION_HXX
30 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVEXCEPTION_HXX
32 #include <config_lgpl.h>
33 #include <rtl/ustring.hxx>
35 namespace webdav_ucp
39 // HTTP/WebDAV status codes
42 const sal_uInt16 SC_NONE = 0;
44 // 1xx (Informational - no errors)
45 const sal_uInt16 SC_CONTINUE = 100;
46 const sal_uInt16 SC_SWITCHING_PROTOCOLS = 101;
47 // DAV extensions
48 const sal_uInt16 SC_PROCESSING = 102;
50 //2xx (Successful - no errors)
51 const sal_uInt16 SC_OK = 200;
52 const sal_uInt16 SC_CREATED = 201;
53 const sal_uInt16 SC_ACCEPTED = 202;
54 const sal_uInt16 SC_NON_AUTHORITATIVE_INFORMATION = 203;
55 const sal_uInt16 SC_NO_CONTENT = 204;
56 const sal_uInt16 SC_RESET_CONTENT = 205;
57 const sal_uInt16 SC_PARTIAL_CONTENT = 206;
58 // DAV extensions
59 const sal_uInt16 SC_MULTISTATUS = 207;
61 //3xx (Redirection)
62 const sal_uInt16 SC_MULTIPLE_CHOICES = 300;
63 const sal_uInt16 SC_MOVED_PERMANENTLY = 301;
64 const sal_uInt16 SC_MOVED_TEMPORARILY = 302;
65 const sal_uInt16 SC_SEE_OTHER = 303;
66 const sal_uInt16 SC_NOT_MODIFIED = 304;
67 const sal_uInt16 SC_USE_PROXY = 305;
68 const sal_uInt16 SC_TEMPORARY_REDIRECT = 307;
70 //4xx (Client error)
71 const sal_uInt16 SC_BAD_REQUEST = 400;
72 const sal_uInt16 SC_UNAUTHORIZED = 401;
73 const sal_uInt16 SC_PAYMENT_REQUIRED = 402;
74 const sal_uInt16 SC_FORBIDDEN = 403;
75 const sal_uInt16 SC_NOT_FOUND = 404;
76 const sal_uInt16 SC_METHOD_NOT_ALLOWED = 405;
77 const sal_uInt16 SC_NOT_ACCEPTABLE = 406;
78 const sal_uInt16 SC_PROXY_AUTHENTICATION_REQUIRED = 407;
79 const sal_uInt16 SC_REQUEST_TIMEOUT = 408;
80 const sal_uInt16 SC_CONFLICT = 409;
81 const sal_uInt16 SC_GONE = 410;
82 const sal_uInt16 SC_LENGTH_REQUIRED = 411;
83 const sal_uInt16 SC_PRECONDITION_FAILED = 412;
84 const sal_uInt16 SC_REQUEST_ENTITY_TOO_LARGE = 413;
85 const sal_uInt16 SC_REQUEST_URI_TOO_LONG = 414;
86 const sal_uInt16 SC_UNSUPPORTED_MEDIA_TYPE = 415;
87 const sal_uInt16 SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
88 const sal_uInt16 SC_EXPECTATION_FAILED = 417;
89 // DAV extensions
90 const sal_uInt16 SC_UNPROCESSABLE_ENTITY = 422;
91 const sal_uInt16 SC_LOCKED = 423;
92 const sal_uInt16 SC_FAILED_DEPENDENCY = 424;
94 //5xx (Server error, general <https://tools.ietf.org/html/rfc7231#section-6.6>)
95 const sal_uInt16 SC_INTERNAL_SERVER_ERROR = 500;
96 const sal_uInt16 SC_NOT_IMPLEMENTED = 501;
97 const sal_uInt16 SC_BAD_GATEWAY = 502;
98 const sal_uInt16 SC_SERVICE_UNAVAILABLE = 503;
99 const sal_uInt16 SC_GATEWAY_TIMEOUT = 504;
100 const sal_uInt16 SC_HTTP_VERSION_NOT_SUPPORTED = 505;
101 // DAV extensions (<https://tools.ietf.org/html/rfc4918#section-11>)
102 const sal_uInt16 SC_INSUFFICIENT_STORAGE = 507;
104 // unofficial status codes only used internally by LO
105 // used to cache the connection time out event
106 const sal_uInt16 USC_CONNECTION_TIMED_OUT = 908;
107 // name resolution failed
108 const sal_uInt16 USC_LOOKUP_FAILED = 909;
109 const sal_uInt16 USC_AUTH_FAILED = 910;
110 const sal_uInt16 USC_AUTHPROXY_FAILED = 911;
114 class DAVException : public std::exception
116 public:
117 enum ExceptionCode {
118 DAV_HTTP_ERROR = 0, // Generic error,
119 // mData = server error message,
120 // mStatusCode = HTTP status code
121 DAV_HTTP_LOOKUP, // Name lookup failed,
122 // mData = server[:port]
123 DAV_HTTP_AUTH, // User authentication failed on server,
124 // mData = server[:port]
125 DAV_HTTP_AUTHPROXY, // User authentication failed on proxy,
126 // mData = proxy server[:port]
127 DAV_HTTP_CONNECT, // Could not connect to server,
128 // mData = server[:port]
129 DAV_HTTP_TIMEOUT, // Connection timed out
130 // mData = server[:port]
131 DAV_HTTP_FAILED, // The precondition failed
132 // mData = server[:port]
133 DAV_HTTP_RETRY, // Retry request
134 // mData = server[:port]
135 DAV_HTTP_REDIRECT, // Request was redirected,
136 // mData = new URL
137 DAV_SESSION_CREATE, // session creation error,
138 // mData = server[:port]
139 DAV_INVALID_ARG, // invalid argument
141 DAV_LOCK_EXPIRED, // DAV lock expired
143 DAV_NOT_LOCKED, // not locked
145 DAV_LOCKED_SELF, // locked by this OOo session
147 DAV_LOCKED // locked by third party
150 private:
151 ExceptionCode mExceptionCode;
152 OUString mData;
153 sal_uInt16 mStatusCode;
155 public:
156 explicit DAVException( ExceptionCode inExceptionCode ) :
157 mExceptionCode( inExceptionCode ), mStatusCode( SC_NONE ) {};
158 DAVException( ExceptionCode inExceptionCode,
159 const OUString & rData ) :
160 mExceptionCode( inExceptionCode ), mData( rData ),
161 mStatusCode( SC_NONE ) {};
162 DAVException( ExceptionCode inExceptionCode,
163 const OUString & rData,
164 sal_uInt16 nStatusCode ) :
165 mExceptionCode( inExceptionCode ), mData( rData ),
166 mStatusCode( nStatusCode ) {};
168 const ExceptionCode & getError() const { return mExceptionCode; }
169 const OUString & getData() const { return mData; }
170 sal_uInt16 getStatus() const { return mStatusCode; }
173 } // namespace webdav_ucp
175 #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_NEON_DAVEXCEPTION_HXX
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */