Return handler

Purpose: Return from current request handler back to its caller.

 return-handler  [ <return value> ]

Returns from current request handler by transferring control back to its caller. If the current request handler is handling an external request (such as from a web browser, API, command line etc.), then return-handler is equivalent to exit-handler. If the current request handler was handling an internal request (i.e. called from another request handler with call-handler), then control transfers back to that handler immediately after call-handler.

For internal requests, the number <return value> will be passed back to the caller, who can obtain it via "return-value" clause in call-handler. If <return value> is omitted, then it is assumed to be 0. If current request handler is handling an external request, then <return value> will also set the handler's exit status (see exit-status and exit-handler).
Examples
In this example, "req-handler" (the caller) will call "other-handler" (the callee), which will return to the caller (immediately after call-handler). Here's the caller:
 begin-handler /req-handler public
     ...
     call-handler "/other-handler" return-value rval
     ...
 end-handler

The callee handler:
 begin-handler /other-handler public
     ...
     return-handler 5
     ...
 end-handler
 The value of "rval" in the caller will be 5.

See also
Program flow
break-loop  
call-handler  
code-blocks  
continue-loop  
do-once  
exit-handler  
if-defined  
if-true  
quit-process  
return-handler  
start-loop  
See all
documentation


Copyright (c) 2019-2025 Gliim LLC. All contents on this web site is "AS IS" without warranties or guarantees of any kind.