# Re: sequel error handeling

**URL:** <https://www.ruby-forum.com/t/re-sequel-error-handeling/169215>\
**Category:** Ruby\
**Created:** [May 31, 2009, 10:43pm UTC](https://www.ruby-forum.com/t/re-sequel-error-handeling/169215 "2009-05-31T22:43:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![spox](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecc23a/32.png) [@spox](https://www.ruby-forum.com/u/spox)\
**Post date:** [May 31, 2009, 10:43pm UTC](https://www.ruby-forum.com/t/re-sequel-error-handeling/169215/1 "2009-05-31T22:43:05Z")

</div>

On Sunday 31 May 2009 05:44:54 am jeljer te Wies wrote:

> but how can i get that error ? … i tried (as you can see):  
> if item.save  
> return true … etc …
> 
> but that doesn’t work ☹ ( obviously) …  
> i googled, read the cheatsheet, readme etc etc.  
> irc doesn’t respond so … hopefully you guys know!!..
> 
> thanxs 😃

You’ll probably get better responses from the sequel list:

[http://groups.google.com/group/sequel-talk](http://groups.google.com/group/sequel-talk)

However, I’m not exactly sure why you define a create method when it is  
already  
provided for you through Sequel::Model.

w = Website.new(:domain =\> ‘[somedomain.com](http://somedomain.com)’)

This will generate an exception if [somedomain.com](http://somedomain.com) already exists. If you  
just  
want that model, whether it has been created previously or not,

w = Website.find\_or\_create(:name =\> ‘[somedomain.com](http://somedomain.com)’)

The methods relating to this you are probably looking for are here:

[http://sequel.rubyforge.org/rdoc/classes/Sequel/Model/InstanceMethods.html](http://sequel.rubyforge.org/rdoc/classes/Sequel/Model/InstanceMethods.html)

Hope that helps.
