mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-21 13:15:50 +00:00
27 lines
577 B
Lua
27 lines
577 B
Lua
local Config = require(script.Parent.Config)
|
|
|
|
local invariant
|
|
|
|
if Config.isDevBuild then
|
|
function invariant(message, ...)
|
|
message = string.format(message, ...)
|
|
|
|
error("Invariant violation: " .. message, 2)
|
|
end
|
|
else
|
|
function invariant(message, ...)
|
|
message = string.format(message, ...)
|
|
|
|
local fullMessage = string.format(
|
|
"Rojo detected an invariant violation within itself:\n" ..
|
|
"%s\n\n" ..
|
|
"This is a bug in Rojo. Please file an issue:\n" ..
|
|
"https://github.com/rojo-rbx/rojo/issues",
|
|
message
|
|
)
|
|
|
|
error(fullMessage, 2)
|
|
end
|
|
end
|
|
|
|
return invariant |