File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
shared/src/main/scala/pine Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -33,13 +33,15 @@ class NodeRenderContext extends RenderContext {
3333
3434 def commit [T <: Singleton ](tag : Tag [T ]): Tag [T ] = {
3535 val r = render(tag)
36- if (r.isEmpty) throw new Exception (" Root node cannot be removed" )
37- else if (diffs.exists {
38- case (TagRef .Each (_), _) => false
39- case (TagRef .Opt (_), _) => false
40- case _ => true
41- }) throw new Exception (s " Some diffs could not be applied: $diffs" )
42- assert(r.length == 1 )
43- r.head.asInstanceOf [Tag [T ]]
36+ if (r.length != 1 ) throw new Exception (" The root must consist of exactly one node" )
37+ else {
38+ if (diffs.exists {
39+ case (TagRef .Each (_), _) => false
40+ case (TagRef .Opt (_), _) => false
41+ case _ => true
42+ }) throw new Exception (s " Some diffs could not be applied: $diffs" )
43+
44+ r.head.asInstanceOf [Tag [T ]]
45+ }
4446 }
4547}
You can’t perform that action at this time.
0 commit comments