Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7414617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:08:10+00:00 2026-05-29T07:08:10+00:00

If I have, for example, an image that pass all the validations, like, size,

  • 0

If I have, for example, an image that pass all the validations, like, size, dimensions, type, etc, but when I have to process it, for some unknown reason ImageMagick throws an error anyway… how should I handle that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:08:11+00:00Added an answer on May 29, 2026 at 7:08 am

    For Rails 4 and earlier the Active Record Validations and Callbacks Guide:

    If any before callback method returns exactly false or raises an exception, the execution chain gets halted and a ROLLBACK is issued […]

    So you can either let the exception bubble up into ActiveRecord or you can trap it yourself, translate it to something that makes sense within the context of your application, and return false. You can register errors inside a before_save callback so something like this might make sense:

    before_save :do_magick_things
    
    private
    
    def do_magick_things
        # ImageMagick stuff...
        true
    rescue ImageMagickError, FatalImageMagickError => e
        errors.add(:base, 'Some sort of sensible version of e.message')
        false
    end
    

    If you can translate the ImageMagick errors into something that makes sense to the end user then trapping and translating the ImageMagick exception (as in do_magick_things) would probably make the most sense; converting the exception into an error message also allows the caller to use save! if they want exceptions or save if they don’t.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example, I have an URL that looks for an image like this: http://example.com/img/foo.png
I have an example of some code that I see often in websites that
I have some image processing Java code in Android that acts upon two large
I have a virtual path (example: ~/Images/Banner.jpg) and I want to make that an
So for example we have real life photo. how to get (relativly to image
I have a image (png file) with opacity 35%, i want for example: Set
I have example of code below. <script type=text/javascript src=assets/scripts/somescript.php>. </script> So, will my browser
I have an example in C# code, but it is using streamWriter . It
I want to have a class Utils, that will have several methods used all
I have an NxM matrix in MATLAB that I would like to reorder in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.