stardog-rb 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/stardog.rb +7 -1
- metadata +1 -1
data/lib/stardog.rb
CHANGED
@@ -33,6 +33,8 @@ module Stardog
|
|
33
33
|
|
34
34
|
DEBUG = ENV["STARDOG_RB_DEBUG"] || false
|
35
35
|
|
36
|
+
class ICVException < Exception; end
|
37
|
+
|
36
38
|
class StardogResponse
|
37
39
|
attr_reader :status, :body
|
38
40
|
|
@@ -216,7 +218,11 @@ module Stardog
|
|
216
218
|
txID = self.begin(db_name)
|
217
219
|
yield txID
|
218
220
|
result = commit(db_name,txID)
|
221
|
+
raise ICVException.new("ICV constraing violated") if(!result.success? && result.body.index("IC validation failed"))
|
219
222
|
result.success? || false
|
223
|
+
rescue ICVException => ex
|
224
|
+
debug "* Error in commit due to ICV constraint violation. Transaction has already be rolled back"
|
225
|
+
raise ex
|
220
226
|
rescue Exception => ex
|
221
227
|
debug "* Error in transaction #{txID}"
|
222
228
|
debug ex.message
|
@@ -450,7 +456,7 @@ module Stardog
|
|
450
456
|
|
451
457
|
# Sets database offline.
|
452
458
|
# * strategy_op: 'WAIT' | 'NO_WAIT', default 'WAIT'.
|
453
|
-
def online_db(dbname, strategy_op)
|
459
|
+
def online_db(dbname, strategy_op = 'WAIT')
|
454
460
|
http_request("PUT", "admin/databases/#{dbname}/online", "application/json", {}, { "strategy" => strategy_op })
|
455
461
|
end
|
456
462
|
|