module Sequel::Plugins::ThrowFailures::InstanceMethods
Public Instance Methods
Source
# File lib/sequel/plugins/throw_failures.rb 41 def valid?(opts = OPTS) 42 catch_hook_failures{super} || false 43 end
Catch any thrown HookFailed exceptions.
Calls superclass method
Private Instance Methods
Source
# 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
Catch any HookFailed exceptions thrown inside the block, and return nil if there were any.
Source
# File lib/sequel/plugins/throw_failures.rb 59 def checked_save_failure(opts=(no_positional_opts = true; OPTS), raise_on_failure: opts[:raise_on_failure], **kw) 60 Sequel::Deprecation.check_keywords(__callee__, no_positional_opts, opts, kw) 61 if raise_on_failure?(raise_on_failure: raise_on_failure) 62 super(raise_on_failure: raise_on_failure) 63 else 64 catch_hook_failures{super(raise_on_failure: raise_on_failure)} 65 end 66 end
Catch any thrown HookFailed exceptions if not raising on failure.
Calls superclass method
Source
# File lib/sequel/plugins/throw_failures.rb 71 def hook_failed_error(msg) 72 e = super 73 throw HookFailed, e 74 rescue UncaughtThrowError 75 e 76 end
Throw HookFailed with the generated error. If the throw is not caught, just return the originally generated error.
Calls superclass method
Source
# File lib/sequel/plugins/throw_failures.rb 80 def validation_failed_error 81 e = super 82 throw ValidationFailed, e 83 rescue UncaughtThrowError 84 e 85 end
Throw ValidationFailed with the generated error. If the throw is not caught, just return the originally generated error.
Calls superclass method