mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-20 17:41:37 +00:00
Add protection against syncing non place projects (#691)
Closes #113. Does what it says on the tin. When you try to sync a non-place project, it gives a clear message instead of crashing.
This commit is contained in:
parent
55ac231cec
commit
66c1cd0d93
2 changed files with 18 additions and 0 deletions
|
|
@ -232,6 +232,22 @@ function ServeSession:__initialSync(serverInfo)
|
|||
Log.error("Could not compute a diff to catch up to the Rojo server: {:#?}", catchUpPatch)
|
||||
end
|
||||
|
||||
for _, update in catchUpPatch.updated do
|
||||
if
|
||||
update.id == self.__instanceMap.fromInstances[game]
|
||||
and update.changedClassName ~= nil
|
||||
then
|
||||
-- Non-place projects will try to update the classname of game from DataModel to
|
||||
-- something like Folder, ModuleScript, etc. This would fail, so we exit with a clear
|
||||
-- message instead of crashing.
|
||||
return Promise.reject(
|
||||
"Cannot sync a model as a place."
|
||||
.. "\nEnsure Rojo is serving a project file that has a DataModel at the root of its tree and try again."
|
||||
.. "\nSee project file docs: https://rojo.space/docs/v7/project-format/"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Log.trace("Computed hydration patch: {:#?}", debugPatch(catchUpPatch))
|
||||
|
||||
local userDecision = "Accept"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue