summaryrefslogtreecommitdiff
path: root/stoc/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-10-12 22:02:15 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-10-14 15:37:17 +0200
commit176e8cf09a527438ec9b2b20ba2df23fa45226bc (patch)
tree76897d74143771a9ee9249c49bbe91da9ffa0433 /stoc/source
parent328d6aae9e2b7a73f6672800629230f5b46d15b1 (diff)
Use exception ctors, instead of setting members later
Avoids overwriting source location in message Change-Id: Ia0290c7dd1ab3ea1357712a27ecab75c7b583dd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157893 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'stoc/source')
-rw-r--r--stoc/source/corereflection/criface.cxx12
-rw-r--r--stoc/source/invocation/invocation.cxx10
-rw-r--r--stoc/source/servicemanager/servicemanager.cxx3
3 files changed, 7 insertions, 18 deletions
diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx
index 458c7c3693a7..23d3d9bae278 100644
--- a/stoc/source/corereflection/criface.cxx
+++ b/stoc/source/corereflection/criface.cxx
@@ -603,17 +603,13 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
}
TYPELIB_DANGER_RELEASE( pReturnType );
- InvocationTargetException aExc;
- aExc.Context = *o3tl::doAccess<Reference<XInterface>>(rObj);
- aExc.Message = "exception occurred during invocation!";
- uno_any_destruct(
- &aExc.TargetException,
+ uno_any_destruct(&aRet,
reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
- uno_type_copyAndConvertData(
- &aExc.TargetException, pUnoExc, cppu::UnoType<Any>::get().getTypeLibType(),
+ uno_type_copyAndConvertData(&aRet, pUnoExc, cppu::UnoType<Any>::get().getTypeLibType(),
getReflection()->getUno2Cpp().get() );
uno_any_destruct( pUnoExc, nullptr );
- throw aExc;
+ throw InvocationTargetException("exception occurred during invocation!",
+ *o3tl::doAccess<Reference<XInterface>>(rObj), aRet);
}
else
{
diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx
index 5c57f5107de9..7da24b3ae0d0 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -639,10 +639,7 @@ Any Invocation_Impl::invoke( const OUString& FunctionName, const Sequence<Any>&
}
else
{
- CannotConvertException aExc;
- aExc.Context = *this;
- aExc.Message = "invocation type mismatch!";
- throw aExc;
+ throw CannotConvertException("invocation type mismatch!", *this, {}, 0, 0);
}
}
@@ -675,10 +672,7 @@ Any Invocation_Impl::invoke( const OUString& FunctionName, const Sequence<Any>&
return aRet;
}
- RuntimeException aExc;
- aExc.Context = *this;
- aExc.Message = "invocation lacking of introspection access!";
- throw aExc;
+ throw RuntimeException("invocation lacking of introspection access!", *this);
}
namespace {
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index cc2a51026ab5..c61e23cf8546 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -687,8 +687,7 @@ Any OServiceManager::getPropertyValue(const OUString& PropertyName)
}
else
{
- UnknownPropertyException except;
- except.Message = "ServiceManager : unknown property " + PropertyName;
+ UnknownPropertyException except("ServiceManager : unknown property " + PropertyName, {});
throw except;
}
}