module Sequel::Plugins::ThrowFailures::InstanceMethods
Public Instance Methods
valid?(opts = OPTS)
click to toggle source
Catch any thrown HookFailed
exceptions.
Calls superclass method
# File lib/sequel/plugins/throw_failures.rb 41 def valid?(opts = OPTS) 42 catch_hook_failures{super} || false 43 end
Private Instance Methods
catch_hook_failures() { || ... }
click to toggle source
Catch any HookFailed
exceptions thrown inside the block, and return nil if there were any.
# File lib/sequel/plugins/throw_failures.rb 49 def catch_hook_failures 50 called = ret = nil 51 catch(HookFailed) do 52 ret = yield 53 called = true 54 end 55 ret if called 56 end
checked_save_failure(opts)
click to toggle source
Catch any thrown HookFailed
exceptions if not raising on failure.
Calls superclass method
# File lib/sequel/plugins/throw_failures.rb 59 def checked_save_failure(opts) 60 if raise_on_failure?(opts) 61 super 62 else 63 catch_hook_failures{super} 64 end 65 end
hook_failed_error(msg)
click to toggle source
Throw HookFailed
with the generated error. If the throw is not caught, just return the originally generated error.
Calls superclass method
# File lib/sequel/plugins/throw_failures.rb 70 def hook_failed_error(msg) 71 e = super 72 throw HookFailed, e 73 rescue UncaughtThrowError 74 e 75 end
validation_failed_error()
click to toggle source
Throw ValidationFailed
with the generated error. If the throw is not caught, just return the originally generated error.
Calls superclass method
# File lib/sequel/plugins/throw_failures.rb 79 def validation_failed_error 80 e = super 81 throw ValidationFailed, e 82 rescue UncaughtThrowError 83 e 84 end