xValorOptional value delivered to Recover.
AdvPL GuideBEGIN SEQUENCE
[BREAK [xValor]]
[RECOVER [USING xRecebido]]
END SEQUENCERoutes controlled Break flow to Recover.
BEGIN SEQUENCE delimits code whose control can be transferred by Break. RECOVER USING receives the optional Break value. This does not automatically capture every runtime error: converting errors into Break requires appropriate ErrorBlock handling and restoration of the previous handler. The example only uses an explicit interruption, without changing the handler or simulating rollback. BEGIN SEQUENCE and BEGIN TRANSACTION serve different purposes. (TOTVS, n.d., ref. 1)
BEGIN SEQUENCE
[BREAK [xValor]]
[RECOVER [USING xRecebido]]
END SEQUENCExValorOptional value delivered to Recover.
Command without its own return; Recover can receive the Break value.
#Include "Protheus.ch"
User Function EdSeq()
Local cReason := ""
Begin Sequence
// Intentional interruption, not a runtime error.
Break("Controlled test")
Recover Using cReason
ConOut(cReason)
End Sequence
Return NilBreak message in Recover; no data written or rolled back. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use
Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.