Exceptions

Hi folks,

I’m using VL inappropriately again.

I’ve got some text that i’m trying to parse but I get errors from the deserializer.
Occasionally the text I’m sending through sometimes has unencoded UTF-8 so it comes through as “\xe2\x80\x80” and similar stuff.

While I’ve made a a small encoding table that I’ll work on growing later, I was wondering how I could call an exception for when the deserializer hits the skids, some sort of try/catch pattern just for scenarios?

Do you want to catch the exception or throw one?

I’m lazily assuming is in the catchable, otherwise Chicken or Egg.

I can see that there is an error stopping my program running by the red out line and there is a large tool tip message, I’d like to catch that error and either manipulate the variable causing the error or return something I can handle later. If I make Throw I’ll need catcher.

Maybe it could be a Try region with an error type enumerator and an exception-delegation pin. Or maybe something more smooth.

a try/catch region would be awesome!

actually there is one in the experimental lib.
pretty easy to use: put the code that could fail into the Try delegate and the code that should be called when an exception is thrown in the Catch delegate.

both receive the input as first argument and will pass the result to the output.

there is one bugger i just noticed, if you use the node as region with both delegates in place, you cannot assign IOBoxes to the catch delegate. and for some weird reason ‘assign’ is here called ‘insert’.

there is also an advanced TryCatch that can have different types as input and result, and also TryCatchFinally.

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.