diff options
author | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2022-08-09 18:42:40 +0200 |
---|---|---|
committer | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2022-08-22 19:03:42 +0200 |
commit | 7e2a8a9869e362ae181ad92f50ea287e9abf85bb (patch) | |
tree | 19f9e174b4beda0ddd9cb040df38c7953cb24f01 /basic | |
parent | 0bda4401eda5b19b1ebfeb712cab6af8c8d1f59b (diff) |
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.heinisch@yahoo.de>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/inc/sbxbase.hxx | 1 | ||||
-rw-r--r-- | basic/source/classes/sb.cxx | 4 | ||||
-rw-r--r-- | basic/source/sbx/sbxbase.cxx | 17 | ||||
-rw-r--r-- | basic/source/sbx/sbxexec.cxx | 2 | ||||
-rw-r--r-- | basic/source/sbx/sbxobj.cxx | 2 |
5 files changed, 22 insertions, 4 deletions
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; } |