Merge remote-tracking branch 'gravitystorm/mygpx'
[potlatch2.git] / net / systemeD / halcyon / connection / XMLConnection.as
index 52c5bc799b5bf7916a71c59b6f79dfd09d5081d3..30aef5e757b43fdc5f31c30a807ded7bff1e3c6e 100644 (file)
@@ -162,11 +162,19 @@ package net.systemeD.halcyon.connection {
            }
 
         private function changesetCreateComplete(event:Event):void {
-            // response should be a Number changeset id
-            var id:Number = Number(URLLoader(event.target).data);
+            var result:String = URLLoader(event.target).data;
+
+            if (result.match(/^^\d+$/)) {
+                // response should be a Number changeset id
+                var id:Number = Number(URLLoader(event.target).data);
             
-            // which means we now have a new changeset!
-            setActiveChangeset(new Changeset(this, id, lastUploadedChangesetTags));
+                // which means we now have a new changeset!
+                setActiveChangeset(new Changeset(this, id, lastUploadedChangesetTags));
+            } else {
+                var results:XML = XML(result);
+
+                throwServerError(results.message);
+            }
         }
 
         private function changesetCreateError(event:IOErrorEvent):void {