basic/inc/sbxbase.hxx | 1 + basic/source/classes/sb.cxx | 4 ++-- basic/source/sbx/sbxbase.cxx | 17 +++++++++++++++++ basic/source/sbx/sbxexec.cxx | 2 +- basic/source/sbx/sbxobj.cxx | 2 +- include/basic/sbxcore.hxx | 2 ++ 6 files changed, 24 insertions(+), 4 deletions(-)
New commits: commit 7e2a8a9869e362ae181ad92f50ea287e9abf85bb Author: Andreas Heinisch <andreas.heini...@yahoo.de> AuthorDate: Tue Aug 9 18:42:40 2022 +0200 Commit: Andreas Heinisch <andreas.heini...@yahoo.de> CommitDate: Mon Aug 22 19:03:42 2022 +0200 tdf#150139 - Add a concrete name to the error message Add a concrete name to the "Property or method not found: $(ARG1)" error message when creating a listener. Change-Id: I76c904793a96082c49f8aa2d45c76c50a453d892 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138061 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de> diff --git a/basic/inc/sbxbase.hxx b/basic/inc/sbxbase.hxx index 80552c2fbf08..e06d76161dec 100644 --- a/basic/inc/sbxbase.hxx +++ b/basic/inc/sbxbase.hxx @@ -36,6 +36,7 @@ class SbxBasicFormater; struct SbxAppData { ErrCode eErrCode; // Error code + OUString aErrorMsg; // Error message for $ARG SbxVariableRef m_aGlobErr; // Global error object std::vector<SbxFactory*> m_Factories; // these are owned by fields in SbiGlobals tools::SvRef<SvRefBase> mrImplRepository; diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 8d87330e469b..f1ab6dd1da0c 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -1325,11 +1325,11 @@ bool StarBASIC::Call( const OUString& rName, SbxArray* pParam ) if( !bRes ) { ErrCode eErr = SbxBase::GetError(); - SbxBase::ResetError(); if( eErr != ERRCODE_NONE ) { - RTError( eErr, OUString(), 0, 0, 0 ); + RTError(eErr, SbxBase::GetErrorMsg(), 0, 0, 0); } + SbxBase::ResetError(); } return bRes; } diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx index 3b70307ec3e7..9d2129e68a1e 100644 --- a/basic/source/sbx/sbxbase.cxx +++ b/basic/source/sbx/sbxbase.cxx @@ -37,6 +37,7 @@ SbxAppData::SbxAppData() : eErrCode(ERRCODE_NONE) + , aErrorMsg(OUString()) , eBasicFormaterLangType(LANGUAGE_DONTKNOW) { } @@ -96,6 +97,21 @@ ErrCode const & SbxBase::GetError() return GetSbxData_Impl().eErrCode; } +OUString const & SbxBase::GetErrorMsg() +{ + return GetSbxData_Impl().aErrorMsg; +} + +void SbxBase::SetError(ErrCode e, const OUString& rMsg) +{ + SbxAppData& r = GetSbxData_Impl(); + if (e && r.eErrCode == ERRCODE_NONE) + { + r.eErrCode = e; + r.aErrorMsg = rMsg; + } +} + void SbxBase::SetError( ErrCode e ) { SbxAppData& r = GetSbxData_Impl(); @@ -111,6 +127,7 @@ bool SbxBase::IsError() void SbxBase::ResetError() { GetSbxData_Impl().eErrCode = ERRCODE_NONE; + GetSbxData_Impl().aErrorMsg = OUString(); } void SbxBase::AddFactory( SbxFactory* pFac ) diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx index d830061f071d..f3abca766d35 100644 --- a/basic/source/sbx/sbxexec.cxx +++ b/basic/source/sbx/sbxexec.cxx @@ -323,7 +323,7 @@ static SbxVariableRef Element } } else - SbxBase::SetError( ERRCODE_BASIC_NO_METHOD ); + SbxBase::SetError( ERRCODE_BASIC_NO_METHOD, aSym ); } *ppBuf = p; return refVar; diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx index f83324a26bb8..4dd054959823 100644 --- a/basic/source/sbx/sbxobj.cxx +++ b/basic/source/sbx/sbxobj.cxx @@ -275,7 +275,7 @@ bool SbxObject::Call( const OUString& rName, SbxArray* pParam ) pMeth->SetParameters( nullptr ); return true; } - SetError( ERRCODE_BASIC_NO_METHOD ); + SetError( ERRCODE_BASIC_NO_METHOD, rName ); return false; } diff --git a/include/basic/sbxcore.hxx b/include/basic/sbxcore.hxx index e5f726e8d016..477858d9656c 100644 --- a/include/basic/sbxcore.hxx +++ b/include/basic/sbxcore.hxx @@ -85,7 +85,9 @@ public: virtual bool LoadCompleted(); static ErrCode const & GetError(); + static OUString const& GetErrorMsg(); static void SetError( ErrCode ); + static void SetError(ErrCode, const OUString&); static bool IsError(); static void ResetError();