mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Refactor error handling and improve code readability in ServeSession and applyPatch
- Enhanced error logging in ServeSession by formatting warning messages for better clarity. - Improved readability in applyPatch by restructuring conditional statements for clarity. - Simplified assertions in tests for script pruning to maintain consistency and readability. These changes aim to improve code maintainability and enhance the clarity of error messages.
This commit is contained in:
parent
9820ec6534
commit
dcd48642be
5 changed files with 25 additions and 27 deletions
|
|
@ -76,10 +76,11 @@ local function applyPatch(instanceMap, patch)
|
|||
remapProgress = false
|
||||
for id, virtualInstance in pairs(patch.added) do
|
||||
local parentInstance = instanceMap.fromIds[virtualInstance.Parent]
|
||||
if not parentInstance then continue end
|
||||
if not parentInstance then
|
||||
continue
|
||||
end
|
||||
for _, child in parentInstance:GetChildren() do
|
||||
if child.Name == virtualInstance.Name
|
||||
and child.ClassName == virtualInstance.ClassName then
|
||||
if child.Name == virtualInstance.Name and child.ClassName == virtualInstance.ClassName then
|
||||
local existingId = instanceMap.fromInstances[child]
|
||||
if existingId and existingId ~= id then
|
||||
Log.trace("Echo remap: {} -> {} for {}", existingId, id, child:GetFullName())
|
||||
|
|
|
|||
|
|
@ -963,7 +963,10 @@ function ServeSession:__connectScriptsOnlyWatchers()
|
|||
local scriptTempId = string.gsub(HttpService:GenerateGUID(false), "-", ""):lower()
|
||||
local encoded = encodeInstance(descendant, prevParentId)
|
||||
if not encoded then
|
||||
Log.warn("Scripts-only: failed to encode new script {}, rolling back temp IDs", descendant:GetFullName())
|
||||
Log.warn(
|
||||
"Scripts-only: failed to encode new script {}, rolling back temp IDs",
|
||||
descendant:GetFullName()
|
||||
)
|
||||
for tempId in patch.added do
|
||||
self.__instanceMap:removeId(tempId)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue