# Handling Errors + Attachment\_Fu

**URL:** <https://www.ruby-forum.com/t/handling-errors-attachment-fu/131041>\
**Category:** Rails\
**Created:** [March 5, 2008, 1:33pm UTC](https://www.ruby-forum.com/t/handling-errors-attachment-fu/131041 "2008-03-05T13:33:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [March 5, 2008, 1:33pm UTC](https://www.ruby-forum.com/t/handling-errors-attachment-fu/131041/1 "2008-03-05T13:33:36Z")

</div>

Hi people, with the attachment\_fu plugin, how can i handle things when  
errors occur with an image upload, so the user doesn’t see a blank  
screen on the production site.

?

Also in general how should I be handling form submit errors, I’m  
using…

def signup  
return unless request.post?  
begin  
…  
#redirect to homepage if all ok  
redirect\_back\_or\_default(:action =\> ‘profile’)

```
rescue ActiveRecord::RecordInvalid
  #if not, redirect to signup page with message
  flash[:notice] = "Sorry, something went wrong"
  render :action => 'signup'
end

```

end

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [March 5, 2008, 3:35pm UTC](https://www.ruby-forum.com/t/handling-errors-attachment-fu/131041/2 "2008-03-05T15:35:03Z")

</div>

Did some research, found some decent tutorials…

[http://www.railsonwave.com/railsonwave/2007/1/19/howto-raise-and-rescue-exceptions-in-ruby-on-rails](http://www.railsonwave.com/railsonwave/2007/1/19/howto-raise-and-rescue-exceptions-in-ruby-on-rails)

[http://wiki.rubyonrails.com/rails/pages/HandlingPreControllerErrors](http://wiki.rubyonrails.com/rails/pages/HandlingPreControllerErrors)

[http://wiki.rubyonrails.com/rails/pages/HowtoSendEmailWhenRailsThrowsAnException](http://wiki.rubyonrails.com/rails/pages/HowtoSendEmailWhenRailsThrowsAnException)

[http://wiki.rubyonrails.org/rails/pages/HowtoConfigureTheErrorPageForYourRailsApp](http://wiki.rubyonrails.org/rails/pages/HowtoConfigureTheErrorPageForYourRailsApp)

going to implement the email-on-error one, would help out a lot when  
things don’t go completely to plan.
