OpenHome Forum
DvAvOpenhomeOOrgPlaylist1Cpp and error reporting - Printable Version

+- OpenHome Forum (http://forum.openhome.org)
+-- Forum: OpenHome (/forumdisplay.php?fid=1)
+--- Forum: Net (/forumdisplay.php?fid=5)
+--- Thread: DvAvOpenhomeOOrgPlaylist1Cpp and error reporting (/showthread.php?tid=1137)



DvAvOpenhomeOOrgPlaylist1Cpp and error reporting - kostic2000 - 03-09-2013 11:43 AM

Hi,

I am new to Openhome, having recently discovered it. I am trying to build an audio renderer app. I have looked at OhMediaPlayer as example, which actually uses a lot of "Core" classes, which according to ohNet README are not supposed to be used externally.

So, I have been implementing play actions by deriving from DvAvOpenhomeOOrgPlaylist1Cpp and could not find any way to report errors from the action implementation functions.

For example, SeekId or SeekIndex, where id is not found or the index is out of boundary I can't see any way of reporting such an error (The example code uses core DvAvOpenhomeOOrgPlaylist1 class, and calls Error on IDvInvocation).

Given these core classes are not part of public API, how can I report an error when deriving from DvAvOpenhomeOOrgPlaylist1Cpp where I only have IDvInvocationStd with no Error method?

Regards,
Kostic


RE: DvAvOpenhomeOOrgPlaylist1Cpp and error reporting - simonc - 03-09-2013 12:38 PM

Thanks for the report. This wasn't a deliberate omission; a future release will add ReportError(TUint aCode, std::string& aDescription) to IDvInvocationStd.

In the meantime, you could either
  • THROW(InvocationError) from an action to indicate failure, sacrificing the ability to set FaultCode, FaultDescription
  • Use the Core APIs, sacrificing the convenience of std::string



RE: DvAvOpenhomeOOrgPlaylist1Cpp and error reporting - kostic2000 - 03-09-2013 12:56 PM

Thanks. This would be cool.

I suppose if one follows usual C++ conventions then throwing a special exception would be a good way to implement this. Also looking at the code behind this class the "Do" methods would have to check for the error condition and should not bother creating normal response upon action method return.

I think catching an exception in the "Do" methods would probably be cleaner. Anyway, just a suggestion.

Regards,
Kostic


RE: DvAvOpenhomeOOrgPlaylist1Cpp and error reporting - SiMet - 15-06-2015 05:22 PM

I'd like to leave my comment here to give reason to improve this functionality.
Ability of return FaultCode with description from action is important for me.

I've created issue on github: https://github.com/openhome/ohNet/issues/19


RE: DvAvOpenhomeOOrgPlaylist1Cpp and error reporting - simonc - 16-06-2015 04:46 PM

(15-06-2015 05:22 PM)SiMet Wrote:  I'd like to leave my comment here to give reason to improve this functionality.
Ability of return FaultCode with description from action is important for me.

I've created issue on github: https://github.com/openhome/ohNet/issues/19

Thanks for the reminder about this. I'll get something added in the next couple of days.


RE: DvAvOpenhomeOOrgPlaylist1Cpp and error reporting - simonc - 17-06-2015 04:21 PM

(16-06-2015 04:46 PM)simonc Wrote:  
(15-06-2015 05:22 PM)SiMet Wrote:  I'd like to leave my comment here to give reason to improve this functionality.
Ability of return FaultCode with description from action is important for me.

I've created issue on github: https://github.com/openhome/ohNet/issues/19

Thanks for the reminder about this. I'll get something added in the next couple of days.

The latest code should allow for this. IDvInvocationStd (passed to every invoked action) now includes

void ReportError(uint32_t aCode, const std::string& aDescription)

Calling this will result in aCode/aDescription being reported as a UPnP fault code. It will also throw an exception, exiting the current action.


RE: DvAvOpenhomeOOrgPlaylist1Cpp and error reporting - SiMet - 18-06-2015 10:25 AM

(17-06-2015 04:21 PM)simonc Wrote:  
(16-06-2015 04:46 PM)simonc Wrote:  
(15-06-2015 05:22 PM)SiMet Wrote:  I'd like to leave my comment here to give reason to improve this functionality.
Ability of return FaultCode with description from action is important for me.

I've created issue on github: https://github.com/openhome/ohNet/issues/19

Thanks for the reminder about this. I'll get something added in the next couple of days.

The latest code should allow for this. IDvInvocationStd (passed to every invoked action) now includes

void ReportError(uint32_t aCode, const std::string& aDescription)

Calling this will result in aCode/aDescription being reported as a UPnP fault code. It will also throw an exception, exiting the current action.

Thank you for very quick fix. It's what I needed