20#include <osl/diagnose.h>
37 return gErrorRegistry;
44 for(
const ErrorHandler *pHdlr : GetErrorRegistry().errorHandlers)
46 if(pHdlr->CreateString(pInfo, rStr))
94static void aDspFunc(
const OUString &rErr,
const OUString &rAction)
96 SAL_WARN(
"vcl",
"Action: " << rAction <<
" Error: " << rErr);
110 auto &rErrorHandlers = GetErrorRegistry().errorHandlers;
111 rErrorHandlers.erase( ::std::remove(rErrorHandlers.begin(), rErrorHandlers.end(),
this),
112 rErrorHandlers.end());
144 rData.
contexts.front()->GetString(pInfo->GetErrorCode(), aAction);
168 nErrFlags = nDynFlags;
176 SAL_WARN(
"vcl",
"Action: " << aAction <<
"Error: " << aErr);
191 pParent, nErrFlags, aErr, aAction);
196 SAL_WARN(
"vcl",
"Error not handled " << pInfo->GetErrorCode());
201 OSL_FAIL(
"ERRCODE_ABORT not handled");
215 GetErrorRegistry().contexts.insert(GetErrorRegistry().contexts.begin(),
this);
220 auto &rContexts = GetErrorRegistry().contexts;
221 rContexts.erase( ::std::remove(rContexts.begin(), rContexts.end(),
this), rContexts.end());
226 return GetErrorRegistry().contexts.empty() ? nullptr : GetErrorRegistry().contexts.front();
273 DBG_ASSERT(ppDynErrInfo[nIdx] == pDynErrInfo,
"ErrHdl: Error not found");
275 if(ppDynErrInfo[nIdx]==pDynErrInfo)
276 ppDynErrInfo[nIdx]=
nullptr;
281 sal_uInt32 nIdx =
nId.GetDynamic() - 1;
285 return std::unique_ptr<ErrorInfo>(pDynErrInfo);
287 return std::make_unique<ErrorInfo>(
nId.StripDynamic());
295 return std::make_unique<ErrorInfo>(
nId);
306 pImpl->RegisterError(
this);
316 return pImpl->nErrId;
std::unique_ptr< ImplDynamicErrorInfo > pImpl
DialogMask GetDialogMask() const
DynamicErrorInfo(ErrCode nUserId, DialogMask nMask)
virtual ~DynamicErrorInfo() override
sal_uInt32 GetDynamic() const
ErrorContext(weld::Window *pWin)
static ErrorContext * GetContext()
std::unique_ptr< ImplErrorContext > pImpl
weld::Window * GetParent()
static bool GetErrorString(ErrCode nId, OUString &rStr)
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
Handles an error.
ErrCode const & GetErrorCode() const
static std::unique_ptr< ErrorInfo > GetErrorInfo(ErrCode)
std::vector< ErrorHandler * > errorHandlers
DynamicErrorInfo * ppDynErrInfo[ERRCODE_DYNAMIC_COUNT]
static void RegisterDisplay(BasicDisplayErrorFunc *)
static void SetLock(bool bLock)
std::vector< ErrorContext * > contexts
static bool CreateString(const ErrorInfo *, OUString &)
void RegisterError(DynamicErrorInfo *)
static void UnRegisterError(DynamicErrorInfo const *)
static std::unique_ptr< ErrorInfo > GetDynamicErrorInfo(ErrCode nId)
ImplDynamicErrorInfo(DialogMask nInMask)
StringErrorInfo(ErrCode nUserId, OUString aStringP, DialogMask nMask=DialogMask::NONE)
#define DBG_ASSERT(sCon, aError)
#define ERRCODE_DYNAMIC_SHIFT
#define ERRCODE_DYNAMIC_COUNT
static void aDspFunc(const OUString &rErr, const OUString &rAction)
DialogMask WindowDisplayErrorFunc(weld::Window *, DialogMask eMask, const OUString &rErr, const OUString &rAction)
void BasicDisplayErrorFunc(const OUString &rErr, const OUString &rAction)
#define SAL_WARN(area, stream)