Loading...
Searching...
No Matches
UsdValidationError Class Reference

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)
 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.
 
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.
 

Friends

class UsdValidationValidator
 

Detailed Description

UsdValidationError is an entity returned by a validation task, which is associated with a UsdValidationValidator.

A UsdValidationError instance contains important information, like:

  • Name - A name the validator writer provided for the error. This is then used to construct an identifier for the error.
  • UsdValidationErrorType - severity of an error,
  • UsdValidationErrorSites - on what sites validationError was reported by a validation task,
  • Message - Message providing more information associated with the error. Such a message is provided by the validator writer, when providing implementation for the validation task function.

UsdValidationError instances will be stored in the UsdValidationContext responsible for executing a set of UsdValidationValidators.

Definition at line 224 of file error.h.

Constructor & Destructor Documentation

◆ UsdValidationError() [1/2]

USDVALIDATION_API UsdValidationError ( )

A default constructed UsdValidationError signifies no error.

◆ UsdValidationError() [2/2]

USDVALIDATION_API UsdValidationError ( const TfToken &  name,
const UsdValidationErrorType &  errorType,
const UsdValidationErrorSites &  errorSites,
const std::string &  errorMsg 
)

Instantiate a ValidationError by providing its name, errorType, errorSites and an errorMsg.

Member Function Documentation

◆ GetErrorAsString()

USDVALIDATION_API std::string GetErrorAsString ( ) const

Returns UsdValidationErrorType and ErrorMessage concatenated as a string.

◆ GetIdentifier()

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.

◆ GetMessage()

const std::string & GetMessage ( ) const
inline

Returns the message associated with this UsdValidationError.

Definition at line 296 of file error.h.

◆ GetName() [1/2]

TfToken GetName ( ) &&
inline

Returns the name token of the UsdValidationError by-value.

Definition at line 259 of file error.h.

◆ GetName() [2/2]

const TfToken & GetName ( ) const &
inline

Returns the name token of the UsdValidationError.

Definition at line 253 of file error.h.

◆ GetSites() [1/2]

UsdValidationErrorSites GetSites ( ) &&
inline

Returns the UsdValidationErrorSite associated with this UsdValidationError by-value.

Definition at line 280 of file error.h.

◆ GetSites() [2/2]

const UsdValidationErrorSites & GetSites ( ) const &
inline

Returns the UsdValidationErrorSite associated with this UsdValidationError.

Definition at line 273 of file error.h.

◆ GetType()

UsdValidationErrorType GetType ( ) const
inline

Returns the UsdValidationErrorType associated with this UsdValidationError.

Definition at line 266 of file error.h.

◆ GetValidator()

const UsdValidationValidator * GetValidator ( ) const
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.

Definition at line 290 of file error.h.

◆ HasNoError()

bool HasNoError ( ) const
inline

Returns true if UsdValidationErrorType is UsdValidationErrorType::None, false otherwise.

Definition at line 325 of file error.h.

◆ operator!=()

bool operator!= ( const UsdValidationError &  other) const
inline

Definition at line 247 of file error.h.

◆ operator==()

bool operator== ( const UsdValidationError &  other) const
inline

Definition at line 239 of file error.h.

Friends And Related Function Documentation

◆ UsdValidationValidator

friend class UsdValidationValidator
friend

Definition at line 334 of file error.h.


The documentation for this class was generated from the following file: