Fail no longer prepends 'Failure:' automatically, now fail_at() does if

no prefix is there.
This commit is contained in:
Bruce Hill 2019-01-27 02:02:40 -08:00
parent 3142ef46a3
commit e6d9996b12
3 changed files with 9 additions and 9 deletions

View File

@ -9,9 +9,9 @@ use "core/control_flow"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(fail $msg) compiles to (" (fail $msg) compiles to ("
at_1_fail(\(quote (this tree).source), 'Failure: \( at_1_fail(\(quote (this tree).source),
"'..\($msg as lua expr)" if $msg else "A failure was triggered here'" \(($msg as lua expr) if $msg else (quote "A failure was triggered here'"))
)) )
") ")
(assume $condition) compiles to: (assume $condition) compiles to:

View File

@ -26,15 +26,15 @@ fail_at = function(source, msg)
end end
local title, err_msg, hint = msg:match("([^:]*):[ \n]+(.*)[ \n]+Hint: (.*)") local title, err_msg, hint = msg:match("([^:]*):[ \n]+(.*)[ \n]+Hint: (.*)")
if not err_msg then if not err_msg then
err_msg, hint = msg:match("*(.*)[ \n]+Hint:[ \n]+(.*)") err_msg, hint = msg:match("(.*)[ \n]+Hint:[ \n]+(.*)")
title = "Error" title = "Failure"
end end
if not err_msg then if not err_msg then
title, err_msg = msg:match("([^:]*):[ \n]+(.*)") title, err_msg = msg:match("([^:]*):[ \n]+(.*)")
end end
if not err_msg then if not err_msg then
err_msg = msg err_msg = msg
title = "Error" title = "Failure"
end end
local err_str = pretty_error({ local err_str = pretty_error({
title = title, title = title,

View File

@ -20,13 +20,13 @@ fail_at = (source, msg)->
title, err_msg, hint = msg\match("([^:]*):[ \n]+(.*)[ \n]+Hint: (.*)") title, err_msg, hint = msg\match("([^:]*):[ \n]+(.*)[ \n]+Hint: (.*)")
if not err_msg if not err_msg
err_msg, hint = msg\match("*(.*)[ \n]+Hint:[ \n]+(.*)") err_msg, hint = msg\match("(.*)[ \n]+Hint:[ \n]+(.*)")
title = "Error" title = "Failure"
if not err_msg if not err_msg
title, err_msg = msg\match("([^:]*):[ \n]+(.*)") title, err_msg = msg\match("([^:]*):[ \n]+(.*)")
if not err_msg if not err_msg
err_msg = msg err_msg = msg
title = "Error" title = "Failure"
err_str = pretty_error{ err_str = pretty_error{
title: title, title: title,