1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_DAVEXCEPTION_HXX
23 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_DAVEXCEPTION_HXX
25 #include <rtl/ustring.hxx>
27 namespace http_dav_ucp
31 // HTTP/WebDAV status codes
34 const sal_uInt16 SC_NONE
= 0;
36 // 1xx (Informational - no errors)
37 const sal_uInt16 SC_CONTINUE
= 100;
38 const sal_uInt16 SC_SWITCHING_PROTOCOLS
= 101;
40 const sal_uInt16 SC_PROCESSING
= 102;
42 //2xx (Successful - no errors)
43 const sal_uInt16 SC_OK
= 200;
44 const sal_uInt16 SC_CREATED
= 201;
45 const sal_uInt16 SC_ACCEPTED
= 202;
46 const sal_uInt16 SC_NON_AUTHORITATIVE_INFORMATION
= 203;
47 const sal_uInt16 SC_NO_CONTENT
= 204;
48 const sal_uInt16 SC_RESET_CONTENT
= 205;
49 const sal_uInt16 SC_PARTIAL_CONTENT
= 206;
51 const sal_uInt16 SC_MULTISTATUS
= 207;
54 const sal_uInt16 SC_MULTIPLE_CHOICES
= 300;
55 const sal_uInt16 SC_MOVED_PERMANENTLY
= 301;
56 const sal_uInt16 SC_MOVED_TEMPORARILY
= 302;
57 const sal_uInt16 SC_SEE_OTHER
= 303;
58 const sal_uInt16 SC_NOT_MODIFIED
= 304;
59 const sal_uInt16 SC_USE_PROXY
= 305;
60 const sal_uInt16 SC_TEMPORARY_REDIRECT
= 307;
63 const sal_uInt16 SC_BAD_REQUEST
= 400;
64 const sal_uInt16 SC_UNAUTHORIZED
= 401;
65 const sal_uInt16 SC_PAYMENT_REQUIRED
= 402;
66 const sal_uInt16 SC_FORBIDDEN
= 403;
67 const sal_uInt16 SC_NOT_FOUND
= 404;
68 const sal_uInt16 SC_METHOD_NOT_ALLOWED
= 405;
69 const sal_uInt16 SC_NOT_ACCEPTABLE
= 406;
70 const sal_uInt16 SC_PROXY_AUTHENTICATION_REQUIRED
= 407;
71 const sal_uInt16 SC_REQUEST_TIMEOUT
= 408;
72 const sal_uInt16 SC_CONFLICT
= 409;
73 const sal_uInt16 SC_GONE
= 410;
74 const sal_uInt16 SC_LENGTH_REQUIRED
= 411;
75 const sal_uInt16 SC_PRECONDITION_FAILED
= 412;
76 const sal_uInt16 SC_REQUEST_ENTITY_TOO_LARGE
= 413;
77 const sal_uInt16 SC_REQUEST_URI_TOO_LONG
= 414;
78 const sal_uInt16 SC_UNSUPPORTED_MEDIA_TYPE
= 415;
79 const sal_uInt16 SC_REQUESTED_RANGE_NOT_SATISFIABLE
= 416;
80 const sal_uInt16 SC_EXPECTATION_FAILED
= 417;
82 const sal_uInt16 SC_UNPROCESSABLE_ENTITY
= 422;
83 const sal_uInt16 SC_LOCKED
= 423;
84 const sal_uInt16 SC_FAILED_DEPENDENCY
= 424;
87 const sal_uInt16 SC_INTERNAL_SERVER_ERROR
= 500;
88 const sal_uInt16 SC_NOT_IMPLEMENTED
= 501;
89 const sal_uInt16 SC_BAD_GATEWAY
= 502;
90 const sal_uInt16 SC_SERVICE_UNAVAILABLE
= 503;
91 const sal_uInt16 SC_GATEWAY_TIMEOUT
= 504;
92 const sal_uInt16 SC_HTTP_VERSION_NOT_SUPPORTED
= 505;
94 const sal_uInt16 SC_INSUFFICIENT_STORAGE
= 507;
98 class DAVException
: public std::exception
102 DAV_HTTP_ERROR
= 0, // Generic error,
103 // mData = server error message,
104 // mStatusCode = HTTP status code
105 DAV_HTTP_LOOKUP
, // Name lookup failed,
106 // mData = server[:port]
107 DAV_HTTP_NOAUTH
, // No User authentication data provided - e.g., user aborts corresponding dialog
108 // mData = server[:port]
109 DAV_HTTP_AUTH
, // User authentication failed on server,
110 // mData = server[:port]
111 DAV_HTTP_AUTHPROXY
, // User authentication failed on proxy,
112 // mData = proxy server[:port]
113 DAV_HTTP_CONNECT
, // Could not connect to server,
114 // mData = server[:port]
115 DAV_HTTP_TIMEOUT
, // Connection timed out
116 // mData = server[:port]
117 DAV_HTTP_FAILED
, // The precondition failed
118 // mData = server[:port]
119 DAV_HTTP_RETRY
, // Retry request
120 // mData = server[:port]
121 DAV_HTTP_REDIRECT
, // Request was redirected,
123 DAV_SESSION_CREATE
, // session creation error,
124 // mData = server[:port]
125 DAV_INVALID_ARG
, // invalid argument
127 DAV_LOCK_EXPIRED
, // DAV lock expired
129 DAV_NOT_LOCKED
, // not locked
131 DAV_LOCKED_SELF
, // locked by this OOo session
133 DAV_LOCKED
// locked by third party
137 ExceptionCode mExceptionCode
;
139 sal_uInt16 mStatusCode
;
142 DAVException( ExceptionCode inExceptionCode
)
143 : mExceptionCode( inExceptionCode
)
145 , mStatusCode( SC_NONE
)
147 DAVException( ExceptionCode inExceptionCode
,
148 const OUString
& rData
)
149 : mExceptionCode( inExceptionCode
)
151 , mStatusCode( SC_NONE
)
153 DAVException( ExceptionCode inExceptionCode
,
154 const OUString
& rData
,
155 sal_uInt16 nStatusCode
)
156 : mExceptionCode( inExceptionCode
)
158 , mStatusCode( nStatusCode
)
160 virtual ~DAVException( ) {};
162 const ExceptionCode
& getError() const { return mExceptionCode
; }
163 const OUString
& getData() const { return mData
; }
164 sal_uInt16
getStatus() const { return mStatusCode
; }
167 } // namespace http_dav_ucp
169 #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_DAVEXCEPTION_HXX
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */