I have the following code:

            begin
                # Create the account with the login, password, and email
given.
                Account.create(:login => loginID, :password => password,
:email => email)

                # Log the new user (a real application wouldn't probably
print
                # the password out though).
                Ramaze::Log.debug "New User Added: loginID = #{loginID}
password = #{password} email = #{email}"

                # Redirect to the login page.
                redirect Rs(:login)
            rescue
                # This user already exists. Set the flash message for them
to
                # try again.
                flash[:message] = "Login #{request[:loginID]} already used.
Please select another."

                # Stay on the register page.
                redirect Rs(:register)
            end


The idea is that we try to insert a new Account into the database and if it
fails, we assume the user already exists, tell them so, and put them back on
the Registration page (this is some Ramaze code for registering a new user
in a web application). Obviously, other database problems could happen
besides the one where the user already exists (I have that the loginID is
unique here). What is the type that would come back here on an error? Is
there a list of all the different errors Sequel can throw?

-- 
Scott
http://steamcode.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to