UNKNOWN CORBA system exception when DevVarLongStringArray cannot be constructed as command return value

When I run the python script below, I get an UNKNOWN CORBA system exception reported to the client in response to the command invocation. This makes it difficult to track down the issue as it is very easy to overlook accidentally transposing the return values. Please could we improve the error message?

import tango
from tango.server import Device, command
from tango.test_context import DeviceTestContext

class MyDevice(Device):
    @command(dtype_out="DevVarLongStringArray")
    def mycommand(self):
        # Oops! I mixed up the order here.
        # This reports an UNKNOWN CORBA system exception to the client.
        return (["a helpful message"], [0])

if __name__ == '__main__':
    print(tango.utils.info())
    with DeviceTestContext(MyDevice, process=True) as proxy:
        ([code], [msg]) = proxy.mycommand()
        assert code == 0

Here is the output I get:

PyTango 9.5.0 (9, 5, 0)
PyTango compiled with:
    Python : 3.12.0
    Numpy  : 1.26.1
    Tango  : 9.5.0
    Boost  : 1.82.0

PyTango runtime is:
    Python : 3.12.2
    Numpy  : 1.26.4
    Tango  : 9.5.0

PyTango running on:
uname_result(system='Linux', node='tangodev', release='6.7.9-200.fc39.x86_64', version='#1 SMP PREEMPT_DYNAMIC Wed Mar  6 19:35:04 UTC 2024', machine='x86_64')

Can't create notifd event supplier. Notifd event not available
Ready to accept request
omniORB: (5) 2024-03-19 08:34:25.227524: Warning: method 'command_inout_4' raised an unexpected exception (not a CORBA exception).
Traceback (most recent call last):
  File "/home/tri/osl/tango/badlongstringarray/bad_longstringarray.py", line 14, in <module>
    ([code], [msg]) = proxy.mycommand()
                      ^^^^^^^^^^^^^^^^^
  File "/home/tri/osl/tango/badlongstringarray/venv/lib64/python3.12/site-packages/tango/device_proxy.py", line 365, in f
    return dp.command_inout(name, *args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tri/osl/tango/badlongstringarray/venv/lib64/python3.12/site-packages/tango/green.py", line 234, in greener
    return executor.run(fn, args, kwargs, wait=wait, timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tri/osl/tango/badlongstringarray/venv/lib64/python3.12/site-packages/tango/green.py", line 124, in run
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/tri/osl/tango/badlongstringarray/venv/lib64/python3.12/site-packages/tango/connection.py", line 116, in __Connection__command_inout
    r = Connection.command_inout_raw(self, name, *args, **kwds)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/tri/osl/tango/badlongstringarray/venv/lib64/python3.12/site-packages/tango/connection.py", line 145, in __Connection__command_inout_raw
    return self.__command_inout(cmd_name, param)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PyTango.CommunicationFailed: DevFailed[
DevError[
    desc = UNKNOWN CORBA system exception
  origin = virtual Tango::DeviceData Tango::Connection::command_inout(const string&, const Tango::DeviceData&) at (/src/cppTango/src/client/devapi_base.cpp:1378)
  reason = API_CorbaException
severity = ERR]

DevError[
    desc = Failed to execute command_inout on device test/nodb/mydevice, command mycommand
  origin = virtual Tango::DeviceData Tango::Connection::command_inout(const string&, const Tango::DeviceData&) at (/src/cppTango/src/client/devapi_base.cpp:1378)
  reason = API_CommunicationFailed
severity = ERR]
]

The line

omniORB: (5) 2024-03-19 08:34:25.227524: Warning: method 'command_inout_4' raised an unexpected exception (not a CORBA exception).

suggests to me that there is some exception which needs to be caught and converted to a DevFailed.