myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2804] trunk/lib/rest.rb: added specific error me


From: noreply
Subject: [myexperiment-hackers] [2804] trunk/lib/rest.rb: added specific error message for workflow processor failures
Date: Tue, 15 Nov 2011 09:27:56 -0500 (EST)

Revision
2804
Author
dgc
Date
2011-11-15 09:27:56 -0500 (Tue, 15 Nov 2011)

Log Message

added specific error message for workflow processor failures

Modified Paths

Diff

Modified: trunk/lib/rest.rb (2803 => 2804)


--- trunk/lib/rest.rb	2011-11-15 14:18:26 UTC (rev 2803)
+++ trunk/lib/rest.rb	2011-11-15 14:27:56 UTC (rev 2804)
@@ -967,22 +967,27 @@
     # Handle the preview and svg images.  If there's a preview supplied, use
     # it.  Otherwise auto-generate one if we can.
 
-    if preview.nil? and content
-      metadata = Workflow.extract_metadata(:type => ob.content_type.title, :data ="" content)
-      preview = metadata["image"].read if metadata["image"]
-    end
+    begin
+      if preview.nil? and content
+        metadata = Workflow.extract_metadata(:type => ob.content_type.title, :data ="" content)
+        preview = metadata["image"].read if metadata["image"]
+      end
 
-    if preview
-      ob.image = preview
-    end
+      if preview
+        ob.image = preview
+      end
 
-    if svg.nil? and content
-      metadata = Workflow.extract_metadata(:type => ob.content_type.title, :data ="" content)
-      svg = metadata["image"].read if metadata["image"]
-    end
+      if svg.nil? and content
+        metadata = Workflow.extract_metadata(:type => ob.content_type.title, :data ="" content)
+        svg = metadata["image"].read if metadata["image"]
+      end
 
-    if svg
-      ob.svg = svg
+      if svg
+        ob.svg = svg
+      end
+
+    rescue
+      return rest_response(500, :reason => "Unable to extract metadata from workflow")
     end
 
     success = if (action == 'create' and opts[:query]['id'])

reply via email to

[Prev in Thread] Current Thread [Next in Thread]