ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# B.20 FailTask Causes the current build script execution to fail and the script to exit with an (optional) error message. Table B.21:聽Attributes NameTypeDescriptionDefaultRequired`message``String`The message to display (reason for script abort)."No Message"No`msg``String`Alias for message"No Message"No`if``String`Name of property that must be set for script to exit.n/aNo`unless``String`Name of property that must `not` be set in order for script to exit.n/aNo`status``Integer`Exit using the specified status code; assuming the generated Exception is not caught, PHP will exit with this status.n/aNo B.20.1 Examples ``` <!-- Exit w/ message --> <fail message="Failed for some reason!" /> <!-- Exit if ${errorprop} is defined --> <fail if="errorprop" message="Detected error!" /> <!-- Exit unless ${dontfail} prop is defined. --> <fail unless="dontfail" message="Detected error!" /> <!-- Using a condition to achieve the same effect: <fail message="Detected error!"> <condition> <not> <isset property="dontfail"/> </not> </condition> </fail> ``` B.20.2 Parameters specified as nested elements. As an alternative to the `if/unless` attributes, conditional failure can be achieved using a single nested `<condition>` element, which should contain exactly one core or custom condition.