HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
error.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_BASE_TF_ERROR_H
8 #define PXR_BASE_TF_ERROR_H
9 
10 /// \file tf/error.h
11 
12 #include "pxr/pxr.h"
14 
16 
17 class TfDiagnosticMgr;
18 
19 /// \class TfError
20 /// \ingroup group_tf_Diagnostic
21 ///
22 /// Represents an object that contains error information.
23 ///
24 /// See \ref page_tf_Diagnostic in the C++ API reference for a detailed
25 /// description of the error issuing API. For a example of how to post an
26 /// error, see \c TF_ERROR(), also in the C++ API reference.
27 ///
28 /// In the Python API, you can raise several different types of errors,
29 /// including coding errors (Tf.RaiseCodingError), run time errors
30 /// (Tf.RaiseRuntimeError), fatal errors (Tf.Fatal).
31 ///
32 class TfError: public TfDiagnosticBase {
33 
34 public:
35  /// Return the error code posted.
36  TfEnum GetErrorCode() const {
37  return GetDiagnosticCode();
38  }
39 
40  /// Return the diagnostic code posted as a string.
41  const std::string& GetErrorCodeAsString() const {
43  }
44 
45 private:
46  TfError(TfEnum errorCode, char const *errCodeString,
47  TfCallContext const &context, const std::string& commentary,
48  TfDiagnosticInfo info, bool quiet);
49 
50  friend class TfDiagnosticMgr;
51 };
52 
54 
55 #endif // PXR_BASE_TF_ERROR_H
TfEnum GetErrorCode() const
Return the error code posted.
Definition: error.h:36
Definition: enum.h:119
PXR_NAMESPACE_OPEN_SCOPE typedef std::any TfDiagnosticInfo
const std::string & GetDiagnosticCodeAsString() const
const std::string & GetErrorCodeAsString() const
Return the diagnostic code posted as a string.
Definition: error.h:41
TfEnum GetDiagnosticCode() const
Return the diagnostic code posted.
Definition: error.h:32
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74