XojoScript - how to match errorInfo with error message?

I’m using XojoScript to compile user-entered code.

When I get a CompilerError, I get an error number and an errorInfo dictionary.

Now, let’s see how this looks for a type mismatch error, like when passing the wrong type to a parameter.

I then get the error 201, which I can look up at Page Not Found — Xojo documentation

I find:

201: Parameter ‘%1’ expects %2, but this is %3.

So I need to fill in the three placeholders with the data from errorInfo.

The errorInfo dictionary contains these keys:

Name: …
FirstType: …
SecondType: …

That is not helpful because, well, how do I know which of these Keys belong to which parameter? This seems like a bug to me, as it makes the task impossible. Either the error msgs should use the key names for the placeholders, or the keys should use numbers that match the placeholder numbers.

Or is there some other info that would help me with this?

Request the dictionary’s Keys. They’ll be returned in the right order.

Since when are dictionaries preserving order!?

I’m just telling you how this currently works. Dictionaries may not preserve order when things are added or removed, but in this case it is how it currently works.

So it accidentally worked by chance?
It would be better to offer the values in an variant array.

[quote=494780:@Christian Schmitz]So it accidentally worked by chance?
It would be better to offer the values in an variant array.[/quote]
I’m not here to discuss or defend a decision that was made ~eight years ago. I was just trying to help Thomas figure out how to fix his immediate problem.

I made a feedback case: <https://xojo.com/issue/60783>

Thank you Greg, for clarifying. I was worried about the key order as well, but if that’s how the IDE does it, then I’m happy.