RStudio Launcher Plugin SDK
1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
|
Class which represents an error. More...
#include <Error.hpp>
Public Member Functions | |
Error () | |
Constructor. | |
Error (const Error &in_other) | |
Copy constructor. More... | |
Error (std::string in_name, int in_code, const ErrorLocation &in_location) | |
Constructor. More... | |
Error (std::string in_name, int in_code, const Error &in_cause, const ErrorLocation &in_location) | |
Constructor. More... | |
Error (std::string in_name, int in_code, std::string in_message, const ErrorLocation &in_location) | |
Constructor. More... | |
Error (std::string in_name, int in_code, std::string in_message, const Error &in_cause, const ErrorLocation &in_location) | |
Constructor. More... | |
~Error () override=default | |
Non-virtual destructor because only Success inherits Error and it will keep Error lightweight. | |
operator bool () const | |
Overloaded operator bool to allow Errors to be treated as boolean values. More... | |
bool | operator! () const |
Overloaded operator ! to allow Errors to be treated as boolean values. More... | |
bool | operator== (const Error &in_other) const |
Equality operator. Two errors are equal if their codes and names are the same. More... | |
bool | operator!= (const Error &in_other) const |
Inequality operator. Two errors are equal if their codes and names are the same. More... | |
void | addOrUpdateProperty (const std::string &in_name, const std::string &in_value) |
Add or updates a property of this error. If any properties with the specified name exist, they will all be updated. More... | |
void | addOrUpdateProperty (const std::string &in_name, const system::FilePath &in_value) |
Add or updates a property of this error. If any properties with the specified name exist, they will all be updated. More... | |
void | addOrUpdateProperty (const std::string &in_name, int in_value) |
Add or updates a property of this error. If any properties with the specified name exist, they will all be updated. More... | |
void | addProperty (const std::string &in_name, const std::string &in_value) |
Adds a property of this error. If a property with the same name already exists, a duplicate will be added. More... | |
void | addProperty (const std::string &in_name, const system::FilePath &in_value) |
Adds a property of this error. If a property with the same name already exists, a duplicate will be added. More... | |
void | addProperty (const std::string &in_name, int in_value) |
Adds a property of this error. If a property with the same name already exists, a duplicate will be added. More... | |
std::string | asString () const |
Formats the error as a string. More... | |
bool | hasCause () const |
Checks whether this error was caused by a separate error. More... | |
const Optional< Error > & | getCause () const |
Gets the error which caused this error. More... | |
int | getCode () const |
Gets the error code. More... | |
const ErrorLocation & | getLocation () const |
Gets the location where the error occurred. More... | |
const std::string & | getMessage () const |
Gets the error message. More... | |
const std::string & | getName () const |
Gets the name of the error. More... | |
const ErrorProperties & | getProperties () const |
Gets the custom properties of the error. More... | |
std::string | getProperty (const std::string &name) const |
Gets a custom property of this error. More... | |
std::string | getSummary () const |
Gets the cause of the error. More... | |
bool | isExpected () const |
Gets whether this error was expected or not. More... | |
void | setExpected () |
Sets the property that indicates that this error was expected. Errors are unexpected by default; only unexpected errors will be logged. Expected errors can be marked as such to suppress logging of those errors. | |
Class which represents an error.
This class should not be derived from since it is returned by value throughout the SDK. Instead, create helper functions for each "subclass" of Error that would be desired.
rstudio::launcher_plugins::Error::Error | ( | const Error & | in_other | ) |
Copy constructor.
in_other | The error to copy. |
rstudio::launcher_plugins::Error::Error | ( | std::string | in_name, |
int | in_code, | ||
const ErrorLocation & | in_location | ||
) |
Constructor.
in_name | A contextual or categorical name for the error. (e.g. "RequestNotSupported") |
in_code | The non-zero error code. Note that an error code of zero indicates success. (e.g. 1) |
in_location | The location of the error. |
rstudio::launcher_plugins::Error::Error | ( | std::string | in_name, |
int | in_code, | ||
const Error & | in_cause, | ||
const ErrorLocation & | in_location | ||
) |
Constructor.
in_name | A contextual or categorical name for the error. (e.g. "RequestNotSupported") |
in_code | The non-zero error code. Note that an error code of zero indicates success. (e.g. 1) |
in_cause | The error which caused this error. |
in_location | The location of the error. |
rstudio::launcher_plugins::Error::Error | ( | std::string | in_name, |
int | in_code, | ||
std::string | in_message, | ||
const ErrorLocation & | in_location | ||
) |
Constructor.
in_name | A contextual or categorical name for the error. (e.g. "RequestNotSupported") |
in_code | The non-zero error code. Note that an error code of zero indicates success. (e.g. 1) |
in_message | The detailed error message. (e.g. "The JobNetworkRequest is not supported by this plugin.") |
in_location | The location of the error. |
rstudio::launcher_plugins::Error::Error | ( | std::string | in_name, |
int | in_code, | ||
std::string | in_message, | ||
const Error & | in_cause, | ||
const ErrorLocation & | in_location | ||
) |
Constructor.
in_name | A contextual or categorical name for the error. (e.g. "RequestNotSupported") |
in_code | The non-zero error code. Note that an error code of zero indicates success. (e.g. 1) |
in_message | The detailed error message. (e.g. "The JobNetworkRequest is not supported by this plugin.") |
in_cause | The error which caused this error. |
in_location | The location of the error. |
void rstudio::launcher_plugins::Error::addOrUpdateProperty | ( | const std::string & | in_name, |
const std::string & | in_value | ||
) |
Add or updates a property of this error. If any properties with the specified name exist, they will all be updated.
in_name | The name of the property to add or update. |
in_value | The new value of the property. |
void rstudio::launcher_plugins::Error::addOrUpdateProperty | ( | const std::string & | in_name, |
const system::FilePath & | in_value | ||
) |
Add or updates a property of this error. If any properties with the specified name exist, they will all be updated.
in_name | The name of the property to add or update. |
in_value | The new value of the property. |
void rstudio::launcher_plugins::Error::addOrUpdateProperty | ( | const std::string & | in_name, |
int | in_value | ||
) |
Add or updates a property of this error. If any properties with the specified name exist, they will all be updated.
in_name | The name of the property to add or update. |
in_value | The new value of the property. |
void rstudio::launcher_plugins::Error::addProperty | ( | const std::string & | in_name, |
const std::string & | in_value | ||
) |
Adds a property of this error. If a property with the same name already exists, a duplicate will be added.
in_name | The name of the property to add or update. |
in_value | The new value of the property. |
void rstudio::launcher_plugins::Error::addProperty | ( | const std::string & | in_name, |
const system::FilePath & | in_value | ||
) |
Adds a property of this error. If a property with the same name already exists, a duplicate will be added.
in_name | The name of the property to add or update. |
in_value | The new value of the property. |
void rstudio::launcher_plugins::Error::addProperty | ( | const std::string & | in_name, |
int | in_value | ||
) |
Adds a property of this error. If a property with the same name already exists, a duplicate will be added.
in_name | The name of the property to add or update. |
in_value | The new value of the property. |
std::string rstudio::launcher_plugins::Error::asString | ( | ) | const |
Formats the error as a string.
Gets the error which caused this error.
int rstudio::launcher_plugins::Error::getCode | ( | ) | const |
Gets the error code.
const ErrorLocation& rstudio::launcher_plugins::Error::getLocation | ( | ) | const |
Gets the location where the error occurred.
const std::string& rstudio::launcher_plugins::Error::getMessage | ( | ) | const |
Gets the error message.
const std::string& rstudio::launcher_plugins::Error::getName | ( | ) | const |
Gets the name of the error.
const ErrorProperties& rstudio::launcher_plugins::Error::getProperties | ( | ) | const |
Gets the custom properties of the error.
std::string rstudio::launcher_plugins::Error::getProperty | ( | const std::string & | name | ) | const |
Gets a custom property of this error.
name | The name of the property to retrieve. |
std::string rstudio::launcher_plugins::Error::getSummary | ( | ) | const |
Gets the cause of the error.
bool rstudio::launcher_plugins::Error::hasCause | ( | ) | const |
Checks whether this error was caused by a separate error.
bool rstudio::launcher_plugins::Error::isExpected | ( | ) | const |
Gets whether this error was expected or not.
|
explicit |
Overloaded operator bool to allow Errors to be treated as boolean values.
bool rstudio::launcher_plugins::Error::operator! | ( | ) | const |
Overloaded operator ! to allow Errors to be treated as boolean values.
bool rstudio::launcher_plugins::Error::operator!= | ( | const Error & | in_other | ) | const |
Inequality operator. Two errors are equal if their codes and names are the same.
in_other | The error to compare with this error. |
bool rstudio::launcher_plugins::Error::operator== | ( | const Error & | in_other | ) | const |
Equality operator. Two errors are equal if their codes and names are the same.
in_other | The error to compare with this error. |