# Handling insert errors when posting to a form

**URL:** <https://www.ruby-forum.com/t/handling-insert-errors-when-posting-to-a-form/83439>\
**Category:** Ruby\
**Created:** [January 26, 2007, 2:19am UTC](https://www.ruby-forum.com/t/handling-insert-errors-when-posting-to-a-form/83439 "2007-01-26T02:19:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jts](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/13edae/32.png) [@jts](https://www.ruby-forum.com/u/jts)\
**Post date:** [January 26, 2007, 2:19am UTC](https://www.ruby-forum.com/t/handling-insert-errors-when-posting-to-a-form/83439/1 "2007-01-26T02:19:20Z")

</div>

I’m working on a ruby script to automate posting to a form. I have some  
code like this:

```auto

  res=Net::HTTP.new(url.host, url.port).start {|http| http.request(req)
}
  p res
  case res
    when Net::HTTPSuccess, Net::HTTPRedirection
       puts "it worked"
       puts res.class
    else
      puts "it didn't work"
  end

```

The problem I have is that if the scripting langauge on the form (php in  
this case) errors out, I don’t know since it will return a 200 response  
code. Is there any way to access the error data better.

thanks

-j
