mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-20 20:55:50 +00:00
* Start splitting apart reconciler, with tests * Reify children in reify * Baseline hydrate implementation * Remove debug print * Scaffold out diff implementation, just supporting name changes * invariant -> error in decodeValue * Flesh out diff and add getProperty * Clear out top-level reconciler interface, start updating code that touches it * Address review feedback * Add (experimental) Selene configuration * Add emptiness checks to PatchSet, remove unimplement invert method * Improve descendant destruction behavior in InstanceMap * Track instanceId on all reify errors * Base implementation of applyPatch, returning partial patches on failure * Change reify to accept InstanceMap and insert instances into it * Start testing applyPatch for removals * Add test for applyPatch adding instances successfully and not * Add , which is just error with formatting * Correctly use new diff and applyPatch APIs * Improve applyPatch logging and fix field name typo * Better debug output when reify fails * Print out unapplied patch in debug mode * Don't write properties if their values are not different. This was exposed trying to sync the Rojo plugin, which has a gigantic ModuleScript in it with the reflection database. This workaround was present in some form in many versions of Rojo, and I guess we still need it. This time, I actually documented why it's here so that I don't forget for the umpteenth time... * Add placeholder test that needs to happen still * Introduce easier plugin testing, write applyPatch properties test * Delete legacy get/setCanonicalProperty files * Fix trying to remove numbers instead of instances * Change applyPatch to return partial patches instead of binary success * Work towards being able to decode and apply refs * Add helpers for PatchSet assertions * Apply refs in reify, test all cases * Improve diagnostics when patches fail to apply * Stop logging when destroying untracked instances, it's ok * Remove read before setting property in applyPatch * Fix diff thinking all properties are changed
37 lines
767 B
Lua
37 lines
767 B
Lua
--[[
|
|
Defines the errors that can be returned by the reconciler.
|
|
]]
|
|
|
|
local Fmt = require(script.Parent.Parent.Parent.Fmt)
|
|
|
|
local Error = {}
|
|
|
|
local function makeVariant(name)
|
|
Error[name] = setmetatable({}, {
|
|
__tostring = function()
|
|
return "Error." .. name
|
|
end,
|
|
})
|
|
end
|
|
|
|
makeVariant("CannotCreateInstance")
|
|
makeVariant("CannotDecodeValue")
|
|
makeVariant("LackingPropertyPermissions")
|
|
makeVariant("OtherPropertyError")
|
|
makeVariant("RefDidNotExist")
|
|
makeVariant("UnknownProperty")
|
|
makeVariant("UnreadableProperty")
|
|
makeVariant("UnwritableProperty")
|
|
|
|
function Error.new(kind, details)
|
|
return setmetatable({
|
|
kind = kind,
|
|
details = details,
|
|
}, Error)
|
|
end
|
|
|
|
function Error:__tostring()
|
|
return Fmt.fmt("Error({}): {:#?}", self.kind, self.details)
|
|
end
|
|
|
|
return Error |