mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-21 05:06:29 +00:00
Update more code to new formatting machinery
This commit is contained in:
@@ -133,7 +133,7 @@ function App:startSession(address, port)
|
||||
-- Details being present indicates that this
|
||||
-- disconnection was from an error.
|
||||
if details ~= nil then
|
||||
Log.warn(tostring(details))
|
||||
Log.warn("Disconnected from an error: {}", details)
|
||||
|
||||
self:setState({
|
||||
appStatus = AppStatus.Error,
|
||||
@@ -207,7 +207,7 @@ function App:render()
|
||||
end
|
||||
|
||||
function App:didMount()
|
||||
Log.trace("Rojo %s initializing", self.displayedVersion)
|
||||
Log.trace("Rojo {} initializing", self.displayedVersion)
|
||||
|
||||
checkUpgrade(self.props.plugin)
|
||||
preloadAssets()
|
||||
|
||||
@@ -20,14 +20,16 @@ function InstanceMap.new(onInstanceChanged)
|
||||
return setmetatable(self, InstanceMap)
|
||||
end
|
||||
|
||||
function InstanceMap:debugState()
|
||||
local buffer = {}
|
||||
function InstanceMap:__fmtDebug(output)
|
||||
output:writeLine("InstanceMap {{")
|
||||
output:indent()
|
||||
|
||||
for id, instance in pairs(self.fromIds) do
|
||||
table.insert(buffer, string.format("- %s: %s", id, instance:GetFullName()))
|
||||
output:writeLine("- {}: {}", id, instance:GetFullName())
|
||||
end
|
||||
|
||||
return table.concat(buffer, "\n")
|
||||
output:unindent()
|
||||
output:writeLine("}")
|
||||
end
|
||||
|
||||
function InstanceMap:insert(id, instance)
|
||||
@@ -44,7 +46,7 @@ function InstanceMap:removeId(id)
|
||||
self.fromIds[id] = nil
|
||||
self.fromInstances[instance] = nil
|
||||
else
|
||||
Log.warn("Attempted to remove nonexistant ID %s", tostring(id))
|
||||
Log.warn("Attempted to remove nonexistant ID {}", id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -56,7 +58,7 @@ function InstanceMap:removeInstance(instance)
|
||||
self.fromInstances[instance] = nil
|
||||
self.fromIds[id] = nil
|
||||
else
|
||||
Log.warn("Attempted to remove nonexistant instance %s", tostring(instance))
|
||||
Log.warn("Attempted to remove nonexistant instance {}", instance)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -66,7 +68,7 @@ function InstanceMap:destroyInstance(instance)
|
||||
if id ~= nil then
|
||||
self:destroyId(id)
|
||||
else
|
||||
Log.warn("Attempted to destroy untracked instance %s", tostring(instance))
|
||||
Log.warn("Attempted to destroy untracked instance {}", instance)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -89,7 +91,7 @@ function InstanceMap:destroyId(id)
|
||||
|
||||
instance:Destroy()
|
||||
else
|
||||
Log.warn("Attempted to destroy nonexistant ID %s", tostring(id))
|
||||
Log.warn("Attempted to destroy nonexistant ID {}", id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -134,10 +134,10 @@ function Reconciler:applyPatch(patch)
|
||||
|
||||
if parentInstance == nil then
|
||||
invariant(
|
||||
"Cannot add an instance from a patch that has no parent.\nInstance %s with parent %s.\nInstanceMap state:\n%s",
|
||||
"Cannot add an instance from a patch that has no parent.\nInstance {} with parent {}.\nState: {:#?}",
|
||||
id,
|
||||
tostring(apiInstance.Parent),
|
||||
self.__instanceMap:debugState()
|
||||
apiInstance.Parent,
|
||||
self.__instanceMap
|
||||
)
|
||||
end
|
||||
|
||||
@@ -150,9 +150,9 @@ function Reconciler:applyPatch(patch)
|
||||
|
||||
if instance == nil then
|
||||
invariant(
|
||||
"Cannot update an instance that does not exist in the reconciler's state.\nInstance ID %s\nInstanceMap state:\n%s",
|
||||
"Cannot update an instance that does not exist in the reconciler's state.\nInstance {}\nState: {:#?}",
|
||||
update.id,
|
||||
self.__instanceMap:debugState()
|
||||
self.__instanceMap
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
local Fmt = require(script.Parent.Parent.Fmt)
|
||||
|
||||
local Config = require(script.Parent.Config)
|
||||
|
||||
local invariant
|
||||
|
||||
if Config.isDevBuild then
|
||||
function invariant(message, ...)
|
||||
message = string.format(message, ...)
|
||||
message = Fmt.fmt(message, ...)
|
||||
|
||||
error("Invariant violation: " .. message, 2)
|
||||
end
|
||||
else
|
||||
function invariant(message, ...)
|
||||
message = string.format(message, ...)
|
||||
message = Fmt.fmt(message, ...)
|
||||
|
||||
local fullMessage = string.format(
|
||||
"Rojo detected an invariant violation within itself:\n" ..
|
||||
|
||||
@@ -19,7 +19,7 @@ local function preloadAssets()
|
||||
table.insert(contentUrls, url)
|
||||
end
|
||||
|
||||
Log.trace("Preloading assets: %s", table.concat(contentUrls, ", "))
|
||||
Log.trace("Preloading assets: {:?}", contentUrls)
|
||||
|
||||
coroutine.wrap(function()
|
||||
ContentProvider:PreloadAsync(contentUrls)
|
||||
|
||||
Reference in New Issue
Block a user