Displaying 20 results from an estimated 70000 matches similar to: "handling specific database exceptions"
2008 Feb 07
2
Catching non-Merb::ControllerExceptions Exceptions
Is there an agreed upon method for handling exceptions thrown by
something outside of Merb? For example, DataMapper now throws a
DataMapper::ObjectNotFoundError when a record isn''t found in the db.
I''d like to catch these exceptions and raise a C:E:NotFound exception
instead, but without having to wrap a lot of code in begin/rescue/end
blocks.
Thanks,
Mike Irwin
2006 Jan 16
1
Handling unexpected db exceptions...
Is there any general way, other than putting in "rescue" catch sections, to
capture exceptions thrown when an unexpected exception is thrown?
Thanks in advance,
James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060116/6c2f4bb9/attachment.html
2007 Sep 02
0
using database for validation
I''ve been playing around with the idea of using the database for model
validation where possible (instead of duplicating that validation in
rails). My first approach to this was to catch exceptions from save/
create and parse the errors, in my case from postgres, to turn them
into something friendlier. Something like:
def update
create
end
def create
begin
super
2008 Mar 06
1
ActiveRecord exception handling
Hi,
I''m writing some scripts on the command line using ActiveRecord, and
some interesting (read: confusing) things are happening with the way
exceptions are caught and re-raised.
In AbstractAdapter.log (connection_adapters/abstract_adapter.rb:144),
Exception is rescued and reraised as an ActiveRecord::StatementInvalid
exception. While in most cases I''m sure this is fine,
2005 Apr 04
0
Validation problem with active record: AssociationTypeMismatch
[Rails] Validation problems: ActiveRecord::AssociationTypeMismatch
Hi everyone, I''m starting on my first rails project and I have a
problem that I''m sure has a simple solution. I have two models, an
address model and a state model. The address belongs_to :state,
foreign_key=>"state" and validate_associated :state
I have new & edit controllers for address
2007 Nov 21
0
Canceled uploads and exceptions.
Hi,
I''m currently putting together a program that allows a user to cancel
a current file upload while it''s happening. When I cancel the upload
in the browser, I get a " Error reading HTTP body: #<RuntimeError:
Socket read returned insufficient data: 4139>" exception.
That''s all fine, and understandable, given the browser just closes the
connection
2006 Mar 16
4
Handling/Catching Exceptions
Hello!
I was wondering, sometimes I raise an exception in my Rails apps, e.g.:
raise SecurityError unless @post.user == logged_in_user
Now: is there any way to catch that SecurityError exception somewhere
and render a custom template? E.g., I want to render
''app/views/content/security_error.rhtml''
Does anyone know how to do this?
Thanks a bunch,
Rob
2008 Jun 04
2
Handling exceptions
Is there a convention for handling exceptions within BackgrounDRb workers?
For example, I have a worker which does some asynchronous data processing
(*not* a scheduled worker) based on some things in the database. However,
if an exception is raised within that worker, then the process for that
worker is killed off. Ideally I would want that worker to just silently
fail and be optimistic that it
2006 Feb 13
1
hackish error handling
I''ve got a block of code that''s turning out.. well - just plain ugly.
So i know I must not be doing it the Ruby way.
The main problem I''m having is in dealing with handling errors - and
just not finding much Rails documentation that gives a deeper
understanding of how to handle errors in Rails (outside of several
docs on the catch-all''s)
the main method
2010 Nov 28
1
[LLVMdev] RFC: Exception Handling Proposal II
On Nov 28, 2010, at 9:50 AM, Duncan Sands wrote:
>>> In Ada you can throw and exception inside a destructor and it does not lead
>>> to program termination.
>>
>> Interesting. I assume that the personality still sees these as just cleanups,
>> so this must be implemented by running the destructor in a handler which
>> aborts both unwinds and throws the
2010 Nov 28
0
[LLVMdev] RFC: Exception Handling Proposal II
Hi John,
>> I'm pointing out that if the invoke instruction
>> is removed and catch information is attached to entire basic blocks, then if no
>> care is taken then it is perfectly possible to use %x before it is defined as
>> explained in my previous email, blowing up the entire LLVM system. Clearly the
>> solution is to not allow this by not allowing values
2010 Sep 26
0
[LLVMdev] LLVM Exception Handling
On 26 September 2010 13:08, Eugene Toder <eltoder at gmail.com> wrote:
> %s = invoke i32 @v(i32 %o) to label %ok
> unwind %x to label %catch
> ok:
> ret i32 %s
>
> catch:
> %type = call i32 @exception_type(i8* %x)
> %r = icmp eq i32 %type, 255 ; 255 is DivisionByZeroException type
> br i1 %r, label %bad, label %worse
>
> bad:
> ret
2010 Oct 27
0
RubyZip Exceptions
Hi,
I am wondering if there is a way of catching exceptions that are
thrown within rubyzip.rb.
For example:
in rubyzip line 583,
private
def set_time(binaryDosDate, binaryDosTime)
@time = Time.parse_binary_dos_format(binaryDosDate,
binaryDosTime)
rescue ArgumentError
puts "Invalid date/time in zip entry"
end
I need to be able to ''catch'' the
2005 Apr 04
1
Validation problems: ActiveRecord::AssociationTypeMismatch
Hi everyone, I''m starting on my first rails project and I have a
problem that I''m sure has a simple solution. I have two models, an
address model and a state model. The address belongs_to :state,
foreign_key=>"state" and validate_associated :state
I have new & edit controllers for address which contain a drop down
list for the state choice. My list was
2006 Jul 28
3
Forms: handle foreign keys (AssociationTypeMismatch)
Hi all
I tried and tried and tried, but I still fail in creating a form with
proper validation and stuff for foreign keys... So I''d really like to
get some help here.
I''m creating a booking site for DJ''s, and for every booking one can
choose one of different countries:
class Booking < ActiveRecord::Base
validates_presence_of :country_id
2008 Aug 25
2
to catch exception from update_attribute
Hi
begin
ActiveRecord::Base.transaction do
pb_status_history = ProblemStatusHistory.new
pb_status_history.problem_id = @problem.id
pb_status_history.problem_status_id =
@problem.problem_status_id
pb_status_history.save!
ret_val=@problem.update_attribute("problem_status_id",''ab'')
if ret_val==false
2010 Nov 25
0
[LLVMdev] RFC: Exception Handling Proposal II
Hi Renato,
> On 25 November 2010 13:31, Duncan Sands<baldrick at free.fr> wrote:
>> In short, all destructors are run, and if any
>> throw
>> exceptions then that fact is noted somewhere (and the exception is not
>> allowed
>> to propagate) and once all destructors have had a chance to run then one
>> instance of Program_Error is thrown at the point
2016 Jan 21
2
Propagation of foreign c++ exceptions (msvc, x64, llvm 3.7.1, MCJIT) through IR code
Hi all,
I have the following code:
[use llvm to generate ir_func() ]
in side the ir_func() there's a call to a native cpp function that throws
an exception.
(Just imagine changing the fibonacci example and calling a native c++ func
that throws inside the fibonacci body)
I can't seem to catch "foreign" exception or any exception using the
following pseudo code:
try {
// cast
2005 Dec 29
7
belongs_to causing NoMethodError exceptions ... ?
I''ve got a really strange problem using belongs_to. I apologize in
advance for the length... this is going to take a while to explain.
Basic idea: Creating a User requires that the user enter an email
address and activation key that matches an existing PendingUser.
After creating the user successfully, that pending user should be
marked as "used".
The problem:
When I
2010 Nov 24
2
[LLVMdev] RFC: Exception Handling Proposal II
On Nov 24, 2010, at 2:59 AM, Renato Golin wrote:
> Hi Bill,
>
> First, I like the idea of being more expressive in IR, since the old
> exception handling style didn't quite express exception handling, but
> alternate paths (resume/unwind). That made DwarfException.cpp a big
> hack. ;)
>
> It also makes the front-end engineer's life a lot easier, since there
>