[Title] remove duplicated job set error code
authorHyoun Jiil <jiil.hyoun@samsung.com>
Wed, 24 Apr 2013 07:23:22 +0000 (16:23 +0900)
committerHyoun Jiil <jiil.hyoun@samsung.com>
Wed, 24 Apr 2013 07:23:22 +0000 (16:23 +0900)
[Type] Enhancement
[Module] Toolchain /
[Priority] Major
[Jira#]
[Redmine#] 9167
[Problem]
[Cause]
[Solution]
[TestCase]

Change-Id: Ie70f2e4635a9e6d9b44b43ef4951dfe70e43721f

src/build_server/BuildServerException.rb
src/build_server/JobManager.rb

index 557e0838b9684d7c41f91e37a03698bc64125712..1daf4a3dabbc01fcf11e7c85d72e9db4d06cb6a6 100644 (file)
@@ -25,6 +25,7 @@ class BuildServerException < Exception
                "ERR020" => "Sending data failed!",
 
                "ERR021" => "No DB exists and create(migrate) DB first!",
+               "ERR022" => "There already exists same job.",
 
                "ERR100" => "Package info file(\"package/pkginfo.manifest\") does not exist!",
                "ERR101" => "Parsing package info file failed!",
index 83f28bbcf808f610569447b015aa82497b1d2430..cc21616c29c7d7b49c6d9fabc4852b81891bf10f 100644 (file)
@@ -423,8 +423,13 @@ class JobManager
                                end
 
                                if j1.is_same_with?(j2) then
-                                       j1.log.error("There already exists same job. (#{j2.id})", Log::LV_USER)
-                                       j1.status = "ERROR"
+                                       begin
+                                               raise BuildServerException.new("ERR022"), "(#{j2.id})"
+                                       rescue BuildServerException => e
+                                               j1.error = e
+                                               j1.log.error(e.err_message(""), Log::LV_USER)
+                                               j1.status = "ERROR"
+                                       end
                                        break
                                end
                        end