Code View

# errors.msg — messages that are errors: an exception class with a throw
# function, a fatal error function and a syslog function.

$MODULE errors
$NAMESPACE app :: errors
$LANGUAGE en

# ConfigMissingException derives from std::exception (publicly, the
# default); ThrowConfigMissing( path ) throws it. what() returns the text.
$EXCEPTION INHERITED std::exception
$THROW ENABLE

$MESSAGE ConfigMissing
@ path std::string const &
"configuration file '{$path}' is missing"
[tr]
"yapılandırma dosyası '{$path}' bulunamadı"

# FatalError( code ) prints the text on std::cerr and runs the EXIT statement.
$THROW DISABLE
$ERROR ENABLE
$ERROR EXIT std::exit( 2 )
$ERROR PREFIX Fatal

$MESSAGE Error
@ code int
|fatal error {$code}, giving up
[tr]
|ölümcül hata {$code}, vazgeçiliyor

# LogStarted( pid ) sends the text to syslog, by default as LOG_DAEMON | LOG_NOTICE.
$ERROR DISABLE
$SYSLOG ENABLE
$SYSLOG FACILITY DAEMON
$SYSLOG LEVEL NOTICE

$MESSAGE Started
@ pid long
"started, pid {$pid}"
[tr]
"başladı, süreç {$pid}"