In Ring 1.25 (GitHub) - RingVM_ErrorHandler() function

29 views
Skip to first unread message

Mahmoud Fayed

unread,
Dec 14, 2025, 11:55:55 PM (4 days ago) Dec 14
to The Ring Programming Language
Hello

This is one of the new features provided by Ring 1.25 (under development)

RingVM_ErrorHandler() function

If this function is defined in Ring code, it will be called when an error occurs, provided the error is not handled by try/catch/done.

Example (1):

1 / 0 ? :done func ringvm_errorhandler ? "We have an error!" ? "Message: " + cCatchError ringvm_passerror()

Output:

We have an error! Message: Error (R1) : Can't divide by zero done

Example (2):

ChangeRingKeyword RingVM_ErrorHandler myErrorHandler ChangeRingKeyword RingVM_SEE myPrint 1/0 ? "BOOM!" func myErrorHandler ? "I don't care about errors at all!" ? "I will act as they don't exist" ringvm_passerror() func myPrint vValue if vValue = nl ring_see(nl) return ok ring_see( "-*{" ) ring_see( vValue ) ring_see( "}*-" )

Output:

-*{I don't care about errors at all!}*- -*{I will act as they don't exist}*- -*{BOOM!}*-

Greetings,
Mahmoud

MOHANNAD ALDULAIMI

unread,
Dec 15, 2025, 6:06:00 AM (4 days ago) Dec 15
to The Ring Programming Language
Hello Mahmoud,

This is very useful feature that used to avoid try/ catch ,

actually i was wondering today if we have such function: ringvm_enablePrint(nstate)

to avoid conditional print in real apps by use logicals:
L_PRINT=0
then check every time we want test output …

instead use this function,e.g:

ringvm_enablePrint(0)
? "No Output"

then before we have output we can use it again to enable print…


best wishes…
Mohannad

Mahmoud Fayed

unread,
Dec 15, 2025, 6:09:52 AM (4 days ago) Dec 15
to The Ring Programming Language
Hello Mohannad

>> "actually i was wondering today if we have such function: ringvm_enablePrint(nstate)"

You can create a library that uses ringvm_see() and check a global variable to control the output

Greetings,
Mahmoud
Reply all
Reply to author
Forward
0 new messages