Kết xuấtvi

ném_lỗi

Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi pack; supporting prose may still be English.

Marks a function as able to throw along a recoverable channel.

Syntax: hàm <name>(...) ném_lỗi → <type> [⇥ <error-type>]

Category#

function

Examples#

radix/corpus/meta/iacit.fab (canonical · modifier)#

Marks a function as able to throw along a recoverable channel.

# =============================================================================
# ném_lỗi — Marks a function as able to throw along a recoverable channel.
# =============================================================================
#
# What this teaches:
#   • the `ném_lỗi` modifier on function declarations — marks a function as throwable
#   • the `⇥` error type annotation for specifying the error type contract
#
# Common mistakes:
#   • Forgetting to declare the ⇥ error type — ném_lỗi requires an explicit ⇥ error type in the function signature.
#
# See also: ném, bắt, ⇥, lỗi, bất_biến
# =============================================================================

# meta/iacit — throwable function modifier
#
# GRAMMAR:
#   funcModifier :← 'ném_lỗi'
#
# EXPECTED OUTPUT:
#   ném_lỗi surface declared
#
# BACKEND:
#   Prefer explicit ⇥ error types for callable contracts; see ném/functio-fallibilis.fab.

interface Canens {
    fn canta(string vox) throws → void
}

main {
    print "iacit modifier declared"
}

Expected output:

iacit modifier declared