Google Groups không còn hỗ trợ đăng ký sử dụng hoặc đăng nội dung mới trên Usenet. Bạn vẫn có thể xem nội dung cũ.

Traps as exceptions

47 lượt xem
Chuyển tới thư đầu tiên chưa đọc

Jens Lideström

chưa đọc,
03:21:11 13 thg 5, 202213/5/22
đến
Hello, mumpstereers

The trap mechanism in Mumps has similarities with the exception mechanism in many other language.

Most examples I have seem of trap usage is for catching unintentional errors.

Is there also a way intentionally trigger an error, which can be caught by a trap, in a way that is similar to throwing an exception?

I am working with GT.M V7.0.

I’m learning about traps from here: http://tinco.pair.com/bhaskar/gtm/doc/books/pg/UNIX_manual/ch13s06.html

This question is cross-posted on Stack Overflow: https://stackoverflow.com/questions/72215952/traps-as-exceptions

K.S. Bhaskar

chưa đọc,
07:22:51 13 thg 5, 202213/5/22
đến
Jens, does ZMESSAGE (https://docs.yottadb.com/ProgrammersGuide/commands.html#zmessage) help?

Regards
– Bhaskar

ed de moel

chưa đọc,
07:55:37 13 thg 5, 202213/5/22
đến
See also: http://71.174.62.16/Demo/AnnoStd?Frame=Main&Page=a106012&Edition=1995
As an example, you could code:
Set a=1 Set $Ecode=",U123," Set b=2
Setting the value of $ECode triggers an error, and the Set b=2 would never be reached.

Hope this helps,
Ed

Jens Lideström

chưa đọc,
08:58:09 13 thg 5, 202213/5/22
đến
Thanks Ed and Bhaskar!

ZMESSAGE and $Ecode are exactly the mechanisms I was looking for.

I don't understand how I could have missed them in the manual. I will investigate them.
0 tin nhắn mới