Wysiwyg-editor: [Improvement] _showErrorMessage with the actual error message

Created on 11 Sep 2017  路  7Comments  路  Source: froala/wysiwyg-editor

Expected behavior.

I would like the _showErrorMessage popup to display the _actual_ error message, not "Something went wrong. Please try again." Especially because you know exactly went wrong. It's in the data sent via trigger:

      editor.events.trigger('file.error', [{
        code: code,
        message: error_messages[code]
      }, response]);

In my specific case, I would like it to say "File is too large." because it execes the maxFileSize

Actual behavior.

Only displays "Something went wrong. Please try again."

Most helpful comment

This has come up for us as well. We've gotten a lot of customers contacting us because the error message "Something went wrong" doesn't give them any way to resolve their own issue.

Finding a string in an existing modal and replacing it on the fly seems very hacky. I echo jpgilchrist's sentiments that if you have the error messages already in a hash, we're better off showing them.

Any one of these error messages would be fine to show a user compared to "Something went wrong":
image

In our case, we're just editing the plugin file to place the "Something went wrong" text with error_messages[code].

This means we have to make sure to always remember to replace it when we upgrade to the new versions, but it's working.

All 7 comments

This is my workaround:

           .on('froalaEditor.file.error', (e, editor, data) => {
                if (data.message) {
                    editor.popups.areVisible()
                        .find('.fr-file-progress-bar-layer.fr-error .fr-message')
                        .text(data.message);
                }
            })

It can be done as described in the last comment. We don't plan to add this as default because there are also errors which might happen on the server side and showing those to users is not ok.

@stefanneculai okay, I know my workaround works, but is that what you would actually recommend doing; or do you have a better suggestion?

@jpgilchrist here is a similar solution I recommend some time ago: https://github.com/froala/wysiwyg-editor/issues/1358#issuecomment-228046725/

Fantastic ty

This has come up for us as well. We've gotten a lot of customers contacting us because the error message "Something went wrong" doesn't give them any way to resolve their own issue.

Finding a string in an existing modal and replacing it on the fly seems very hacky. I echo jpgilchrist's sentiments that if you have the error messages already in a hash, we're better off showing them.

Any one of these error messages would be fine to show a user compared to "Something went wrong":
image

In our case, we're just editing the plugin file to place the "Something went wrong" text with error_messages[code].

This means we have to make sure to always remember to replace it when we upgrade to the new versions, but it's working.

There should be a way of dynamically injecting these during initialization.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adilsonb picture adilsonb  路  3Comments

archonic picture archonic  路  4Comments

rogersteblerbsi picture rogersteblerbsi  路  3Comments

thedotedge picture thedotedge  路  4Comments

bnjmnfnk picture bnjmnfnk  路  4Comments