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>
This commit is contained in:
Andreas Heinisch
2022-08-22 19:03:42 +02:00
parent 0bda4401ed
commit 7e2a8a9869
6 changed files with 24 additions and 4 deletions
+1
View File
@@ -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;
+2 -2
View File
@@ -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;
}
+17
View File
@@ -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 )
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
}
+2
View File
@@ -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();