-
-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow error message to be display in notice #59
base: master
Are you sure you want to change the base?
Conversation
Allow error message to be returned from server side (and displayed in notice) together with success: 0 in the following form: ``` { "success": "0", "message": "File too large" } ```
@neSpecc any news with regards this? Thanks. |
This would be really nice. I'm currently factoring my code to support this format, makes a ton of sense. |
Would be fantastic if this could be merged. A custom error message is badly needed (especially because the current error message is grammatically wrong). |
any news? |
I, too, think this is an important change that should be made. My main use case for it is for when a user's session expires (or they log out in another tab). Currently, the message they get when an upload fails in this scenario is "Couldn’t upload image. Please try another.", which causes users to think that there's something wrong with the particular image they chose. It would be nice to be able to tell them that they're logged out and need to log back in. |
Hi! any news about this? ATM error message displayed by notifier cannot be customized in any way. |
|
||
|
||
let errorMessage = 'Can not upload an image, try another.'; | ||
let errorJson = JSON.parse(errorText); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to parse JSON, because it is already parsed in the method above. Use the errorText
argument instead.
if (errorJson.hasOwnProperty('message')) { | ||
errorMessage = errorJson.message; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, update a readme describing that feature
Hey @mpandzo can you pls provide the access to your fork so I can update the PR. |
I've submitted another PR to implement this improvement: #245. |
Allow error message to be returned from server side (and displayed in notice) together with success: 0 in the following form:
cc @neSpecc