![]() |
|
UsdValidationError is an entity returned by a validation task, which is associated with a UsdValidationValidator. More...
#include <error.h>
Public Member Functions | |
| USDVALIDATION_API | UsdValidationError () |
| A default constructed UsdValidationError signifies no error. | |
| USDVALIDATION_API | UsdValidationError (const TfToken &name, const UsdValidationErrorType &errorType, const UsdValidationErrorSites &errorSites, const std::string &errorMsg, const VtValue &metadata=VtValue()) |
Instantiate a ValidationError by providing its name, errorType, errorSites and an errorMsg. | |
| bool | operator== (const UsdValidationError &other) const |
| bool | operator!= (const UsdValidationError &other) const |
| const TfToken & | GetName () const & |
| Returns the name token of the UsdValidationError. | |
| TfToken | GetName () && |
| Returns the name token of the UsdValidationError by-value. | |
| UsdValidationErrorType | GetType () const |
| Returns the UsdValidationErrorType associated with this UsdValidationError. | |
| const UsdValidationErrorSites & | GetSites () const & |
| Returns the UsdValidationErrorSite associated with this UsdValidationError. | |
| UsdValidationErrorSites | GetSites () && |
| Returns the UsdValidationErrorSite associated with this UsdValidationError by-value. | |
| const UsdValidationValidator * | GetValidator () const |
| Returns the UsdValidationValidator that reported this error. | |
| const std::string & | GetMessage () const |
| Returns the message associated with this UsdValidationError. | |
| const VtValue & | GetMetadata () const |
| Returns the metadata associated with this UsdValidationError. | |
| USDVALIDATION_API TfToken | GetIdentifier () const |
| An identifier for the error constructed from the validator name this error was generated from and its name. | |
| USDVALIDATION_API std::string | GetErrorAsString () const |
| Returns UsdValidationErrorType and ErrorMessage concatenated as a string. | |
| bool | HasNoError () const |
| Returns true if UsdValidationErrorType is UsdValidationErrorType::None, false otherwise. | |
| USDVALIDATION_API const std::vector< const UsdValidationFixer * > | GetFixers () const |
| Return a vector of fixers associated with this Validator. | |
| USDVALIDATION_API const UsdValidationFixer * | GetFixerByName (const TfToken &name) const |
Return an immutable fixer given its name if it exists, else return nullptr. | |
| USDVALIDATION_API const std::vector< const UsdValidationFixer * > | GetFixersByErrorName () const |
Return a vector of immutable fixers catering to a specific errorName. | |
| USDVALIDATION_API const UsdValidationFixer * | GetFixerByNameAndErrorName (const TfToken &name) const |
Return an immutable fixer given its name and catering to a specific error name if it exists, else return nullptr. | |
| USDVALIDATION_API const std::vector< const UsdValidationFixer * > | GetFixersByKeywords (const TfTokenVector &keywords) const |
Return a vector of immutable fixers catering to any of the given keywords. | |
Friends | |
| class | UsdValidationValidator |
UsdValidationError is an entity returned by a validation task, which is associated with a UsdValidationValidator.
A UsdValidationError instance contains important information, like:
UsdValidationError instances are typically created by the validation task functions, and returned as part of the vector of errors from a call to UsdValidationValidator::Validate() function.
A default constructed UsdValidationError instance signifies no error.
A UsdValidationError instance contains a pointer to the UsdValidationValidator that generated it, which can be retrieved using GetValidator() method.
A UsdValidationError instance can also provide access to the fixers associated with the validator that generated it, which can be retrieved using various GetFixer*() methods.
| USDVALIDATION_API UsdValidationError | ( | ) |
A default constructed UsdValidationError signifies no error.
| USDVALIDATION_API UsdValidationError | ( | const TfToken & | name, |
| const UsdValidationErrorType & | errorType, | ||
| const UsdValidationErrorSites & | errorSites, | ||
| const std::string & | errorMsg, | ||
| const VtValue & | metadata = VtValue() |
||
| ) |
Instantiate a ValidationError by providing its name, errorType, errorSites and an errorMsg.
| USDVALIDATION_API std::string GetErrorAsString | ( | ) | const |
Returns UsdValidationErrorType and ErrorMessage concatenated as a string.
| USDVALIDATION_API const UsdValidationFixer * GetFixerByName | ( | const TfToken & | name | ) | const |
Return an immutable fixer given its name if it exists, else return nullptr.
| USDVALIDATION_API const UsdValidationFixer * GetFixerByNameAndErrorName | ( | const TfToken & | name | ) | const |
Return an immutable fixer given its name and catering to a specific error name if it exists, else return nullptr.
| USDVALIDATION_API const std::vector< const UsdValidationFixer * > GetFixers | ( | ) | const |
Return a vector of fixers associated with this Validator.
| USDVALIDATION_API const std::vector< const UsdValidationFixer * > GetFixersByErrorName | ( | ) | const |
Return a vector of immutable fixers catering to a specific errorName.
| USDVALIDATION_API const std::vector< const UsdValidationFixer * > GetFixersByKeywords | ( | const TfTokenVector & | keywords | ) | const |
Return a vector of immutable fixers catering to any of the given keywords.
Fixers can be associated with keywords, like unit, department, etc. which can be used to filter fixers based on the context in which they are being queried.
| USDVALIDATION_API TfToken GetIdentifier | ( | ) | const |
An identifier for the error constructed from the validator name this error was generated from and its name.
Since a validator may result in multiple distinct errors, the identifier helps in distinguishing and categorizing the errors. The identifier returned will be in the following form: For a plugin validator: "plugName":"validatorName"."ErrorName" For a non-plugin validator: "validatorName"."ErrorName"
For an error that was generated without a name, the identifier will be same as the validator name which generated the error.
For an error which is created directly and not via UsdValidationValidator::Validate() call, we throw a coding error, as its an improper use of the API.
|
inline |
Returns the message associated with this UsdValidationError.
|
inline |
Returns the metadata associated with this UsdValidationError.
Validator writers can provide additional metadata when creating a UsdValidationError instance, which can then be retrieved using this method, and may be used by the fixer associated with the validator.
|
inline |
Returns the name token of the UsdValidationError by-value.
|
inline |
Returns the name token of the UsdValidationError.
|
inline |
Returns the UsdValidationErrorSite associated with this UsdValidationError by-value.
|
inline |
Returns the UsdValidationErrorSite associated with this UsdValidationError.
|
inline |
Returns the UsdValidationErrorType associated with this UsdValidationError.
|
inline |
Returns the UsdValidationValidator that reported this error.
This will return nullptr if there is no UsdValidationValidator associated with this error. This will never be nullptr for validation errors returned from calls to UsdValidationValidator::Validate.
|
inline |
Returns true if UsdValidationErrorType is UsdValidationErrorType::None, false otherwise.
|
inline |
|
inline |
|
friend |