Is this supposed to happen with the error block?

Maybe this is a bug. I don't know. But whenever I use the error block, it shows the primitive block in the message. It's quite annoying. Is there any way to fix this?

image

Yes, that's supposed to happen.

I think you need tu put an error message inside the error block. This msg will be display to user when this error occurs

No. That picture was just an example. It happens even if there is a message.

Is there a way to fix it?

No, I don't think so.

page 32:


this block always generate an error message

ex. you make a custom block and you want the parameter be always an even number by example
the block:
image
the error:
image
this block always throw an error, if you don't provide an error message:
image
the block report an error without message

I think you guys are missing the OP's point. The complaint isn't that the block throws an error, but rather that in the actual text of the error message it shows a PRIMITIVE block instead of the ERROR block.

Right now, when an error happens, it's always a primitive block that you see in the message. The PRIMITIVE block is just like other primitive blocks in this respect.

On my long-term wish list, but I'm guessing something Jens won't go for, is the ability to declare a custom block to be "quasi-primitive." This would mean that if an error happens while running the block, the block itself would be treated as the one throwing the error, and its caller would be used as the location of the bad call. It'd be useful for all library blocks, not just PRIMITIVE.

Thanks, BH. This is what I meant.

sry, i don't see this detail at first reading, my translation skills make me forget certain details (I speak French)

Would you like me to remove the comment on page 32 of the manual?

Doesn't matter.

(Boring facts ahead. Not necessary to read.)
I don't speak French fluently. But I live in Canada so, here the national languages are French and English. Although only people from Quebec (the French province/state) speak French in their daily lives. But, I go to a French school where you can find around the non-French parts of Canada. So, I've been learning French for 8 years as I'm in eighth grade. So yeah. My point: I speak French too, just not fluently.

In fact, I come from Quebec ...

Ah. A fellow Canadian. I thought I was the only one!

Why not stack trace?
There are my old experiments with partial evaluation
Do you think that stack traces, shown this way, are beyond of the mental abilities of average Snap! user?


untitled script pic - 2022-01-01T215403.815
The name "stack trace" is misleading as a part o unfinished experiments but JS block does the trick.

Yes, that's a great idea. But even so, I think library blocks should be treated as primitive; the trace shouldn't go into them. The idea is that when we bless a library that means it's bug-free, so when something goes wrong inside a library block, it's because the user called it with inputs not in its domain.

Thank you for pointing this out. I've just released a patch (v7.0.3) that addresses this (and some other) issues. You may need to perform a "hard reload" (reload Snap! in the browser while keeping the shift key down) or to flush your browser cache in order for the changes to become active right away.

No problem! :slight_smile: And thank you very much

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