RStudio Launcher Plugin SDK  1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
LocalError.hpp
1 /*
2  * LocalError.hpp
3  *
4  * Copyright (C) 2020 by RStudio, PBC
5  *
6  * Unless you have received this program directly from RStudio pursuant to the terms of a commercial license agreement
7  * with RStudio, then this program is licensed to you under the following terms:
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
10  * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
11  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
15  * Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18  * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  */
23 
24 
25 #ifndef LAUNCHER_PLUGINS_LOCAL_ERROR_HPP
26 #define LAUNCHER_PLUGINS_LOCAL_ERROR_HPP
27 
28 #include <string>
29 
30 #include <Error.hpp>
31 
32 namespace rstudio {
33 namespace launcher_plugins {
34 namespace local {
35 
36 const constexpr char* s_errorName = "LocalPluginError";
37 
42 enum class LocalError
43 {
45  SUCCESS = 0,
46 
48  INVALID_MOUNT_TYPE = 1,
49 
51  INVALID_JOB_CONFIG = 2,
52 
54  JOB_LAUNCH_ERROR = 3,
55 
57  NO_PID = 4,
58 
60  UNSUPPORTED_OP = 5,
61 };
62 
73 Error createError(
74  LocalError in_code,
75  const std::string& in_message,
76  const Error& in_cause,
77  const ErrorLocation& in_errorLocation);
78 
88 Error createError(LocalError in_code, const std::string& in_message, const ErrorLocation& in_errorLocation);
89 
90 
100 Error createError(LocalError in_code, const Error& in_cause, const ErrorLocation& in_errorLocation);
101 
102 
111 Error createError(LocalError in_code, const ErrorLocation& in_errorLocation);
112 
113 } // namespace local
114 } // namespace launcher_plugins
115 } // namespace rstudio
116 
117 #endif