Forum

VL.Telegram

hey there,

i’m working on a new version of the telegram contribution, this time as VL-based nodes.

basic functionality is there already but some issues remain. will post them as soon as these could be adressed. stay tuned…

2 Likes

question to the devs:

i’m fighting with exception handling in VL: the communication between the base library and the telegram servers happens mostly by async function calls, which internally create HTTP requests. when the request return errors (e.g. 404) an exception is thrown.
executing the calling function from within a try-region does not catch the exception (maybe because it happens async?). is there a way to catch these exceptions?

------------------------------------------------------------------------------
Exception class: EClrException
Exception message: Response status code does not indicate success: 404 (Not Found).
Exception address: 0000000000000000
------------------------------------------------------------------------------
System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
   at VL.Core.RuntimeGraph.HandleException(UInt32 rootId) in C:\BuildAgent\work\95074898639d5736\public-vl\VL.Core\src\RuntimeGraph.cs:line 123
   at VVVV.VL.Hosting.NodePlugin.Evaluate(Int32 spreadMax) in C:\BuildAgent\work\95074898639d5736\vvvv50\VVVV.VLIntegration\src\NodePlugin.cs:line 0

if you use Task.Result (which is blocking) the exception should be thrown in the region.

then wrap everything in an AsyncTask region to get the async behavior back…

thanks @tonfilm . this way it is possible to catch the exception. unfortunately i’m loosing the info on what kind of exception was causing the troubles as the try-region only outputs a string like “one or more errors caused the exception”.

on the other hand when not using an async region and using HoldLatestError it is possible to catch the cause but the exception is rethrown, which I’d like to prevent.

any idea how to get the type of exception and catch it also?

the TryCatch region has a catch operation inside, there you get the full .NET exception. note that this region has two layers inside, Try and Catch. you need to assign your nodes to one or the other.

i was looking into TryCatch already but i’m not sure how that region would help me, as the output of the Catch-layer has to be of the same data-type as the Try layer.

the only thing I could think of would be the creation of a new type (or tuple), wrapping type and some string to output it together, and unwrap it outside. this feels quite awkward as one part of this structure would always be empty - is there a more elegant way?

grafik
grafik

Well, it seems to do the trick. If there are more elegant solutions, please tell…

there should be a TryCatch with two outputs which saves you the tuple. or are you on beta36?

good idea, but anyways then i’m stuck with the single output from AsyncTask. so it seems the tuple is the way to go…

alright - first version to try is here:

VL.Telegram.0.0.1.zip (114.1 KB)

nuget is in the working…

2 Likes

Just tried this since the vvvv version doesn’t work with 38.1, and this does not either. all nodes red. Doesn’t work for me under 35.8 either, which the vvvv version does.

So is there no workable version for recent releases? Are there some dependencies I may be missing? Thanks @motzi for a very useful plugin, I miss it!

hey @mediadog, thanks for noting this and glad you like it. i did not have a look into this for quite some time now and unfortunately am quite busy atm. however, I do consider giving this an update as soon as time permits. sorry for leaving this in an unfinished state…

@mediadog - i just opened it up for a quick look. did you install all dependencies? vl.telegram menu->dependencies -> right click missing dependencies and install them.

this should solve our red node problem (just checked with alpha 38.2 but should be the same with b38.1). however, i could only connect to a bot but not send messages to it (and therefore send something back). this needs more investigation…