Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
audacity::sentry::anonymous_namespace{SentryReport.cpp}::ExceptionContext Class Referencefinal

Helper class to store additional details about the exception. More...

Collaboration diagram for audacity::sentry::anonymous_namespace{SentryReport.cpp}::ExceptionContext:
[legend]

Public Member Functions

void Add (std::string parameterName, AnonymizedMessage parameterValue)
 Adds a new item to the exception context. More...
 
std::vector< ExceptionDataMoveParameters ()
 Return the current context and reset it. More...
 

Static Public Member Functions

static ExceptionContextGet ()
 Get an instance of the ExceptionContext. More...
 

Private Member Functions

 ExceptionContext ()=default
 

Private Attributes

std::mutex mDataMutex
 
std::vector< ExceptionDatamData
 

Detailed Description

Helper class to store additional details about the exception.

This small class is a thread safe store for the information we want to add to the exception before the exception occurs. For example, we may log SQLite3 return codes here, as otherwise they wont be available when everything fails

Definition at line 49 of file SentryReport.cpp.

Constructor & Destructor Documentation

◆ ExceptionContext()

audacity::sentry::anonymous_namespace{SentryReport.cpp}::ExceptionContext::ExceptionContext ( )
privatedefault

Member Function Documentation

◆ Add()

void audacity::sentry::anonymous_namespace{SentryReport.cpp}::ExceptionContext::Add ( std::string  parameterName,
AnonymizedMessage  parameterValue 
)
inline

Adds a new item to the exception context.

Definition at line 53 of file SentryReport.cpp.

54 {
55 std::lock_guard<std::mutex> lock(mDataMutex);
56 mData.emplace_back(std::move(parameterName), std::move(parameterValue));
57 }

◆ Get()

static ExceptionContext & audacity::sentry::anonymous_namespace{SentryReport.cpp}::ExceptionContext::Get ( )
inlinestatic

Get an instance of the ExceptionContext.

Definition at line 72 of file SentryReport.cpp.

73 {
74 static ExceptionContext instance;
75 return instance;
76 }

◆ MoveParameters()

std::vector< ExceptionData > audacity::sentry::anonymous_namespace{SentryReport.cpp}::ExceptionContext::MoveParameters ( )
inline

Return the current context and reset it.

Definition at line 60 of file SentryReport.cpp.

61 {
62 std::lock_guard<std::mutex> lock(mDataMutex);
63
64 std::vector<ExceptionData> emptyVector;
65
66 std::swap(mData, emptyVector);
67
68 return emptyVector;
69 }
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
Definition: NoteTrack.cpp:628

References anonymous_namespace{NoteTrack.cpp}::swap().

Here is the call graph for this function:

Member Data Documentation

◆ mData

std::vector<ExceptionData> audacity::sentry::anonymous_namespace{SentryReport.cpp}::ExceptionContext::mData
private

Definition at line 82 of file SentryReport.cpp.

◆ mDataMutex

std::mutex audacity::sentry::anonymous_namespace{SentryReport.cpp}::ExceptionContext::mDataMutex
private

Definition at line 81 of file SentryReport.cpp.


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