Allow for custom CarrierWave error messages #450

Merged
merged 3 commits into from Sep 22, 2011

3 participants

@bartt

Hi Jonas,

this patch allows one to rais CarrierWave errors with custom messages. Prior to this patch all processing errors would read: 'failed to be processed' even when one raises a CarrierWave processing error with a custom message.

Similarly CarrierWave's own integrity error message is replaced with the rather short "is not an allowed file type" w/o explaining what extensions are accepted.

I hope you'll accept this patch.

@jnicklas
CarrierWave member

Could you add some tests for this behaviour, not sure I quite understand what this is doing?

Bart Teeuwisse - I18n all error messages.
- Add test for all but mime_types
c564f2a
@bartt

Jonas, I've added test cases and I18n all error messages. Give it try. See if you can force a ::MIME::InvalidContentType error, that is the only one missing.

@trevorturk

@bartt I'm seeing "This pull request cannot be automatically merged." so you may need to rebase your commits in order for us to merge. I'd check with @jnicklas before doing more work, though -- I'm not clear on whether or not he's interested in merging.

Bart Teeuwisse Merge branch 'master' of git://github.com/jnicklas/carrierwave
Conflicts:
	spec/orm/activerecord_spec.rb
769622a
@bartt

@trevorturk, conflict resolved. I do hope @jnicklas will merge the changes as the current code doesn't allow for custom error messages. These changes allow for custom error messages while preserving i18n.

@trevorturk trevorturk merged commit 84b3918 into carrierwaveuploader:master Sep 22, 2011
@trevorturk

Merged -- thanks @bartt!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment