question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is it possible to change error message?

See original GitHub issue

image

I tried to change onerror in server options but it didnt work:

setOptions({
    server: {
        url: '/admin/upload',
        process: {
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content'),
            },
            onerror: res => {
                debugger
                return '123'
            },
        },
    },
})
Environment Version
OS Windows 10
Browser Google Chrome 68.0.3440.106

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:15

github_iconTop GitHub Comments

4reactions
riliwanrabocommented, May 13, 2021
const inputElement = document.querySelector('input[type="file"]');
const pond = FilePond.create(inputElement);
let serverResponse = '';
pond.setOptions({
    server: {
        process: {
            url: '/upload',
            onerror: (response) => {
                // I am returning JSON from the backend e.g '{"message": "upload the right documents"}'
                serverResponse = JSON.parse(response);
            }
        },
        revert: '/upload/revert',
        headers: {
            'Accept': 'application/json',
            'X-CSRF-TOKEN': '{{ @csrf_token() }}' // laravel csrf token (substitute with your token)
        }
    },
    labelFileProcessingError: () => {
        // replaces the error on the FilePond error label
        return serverResponse.message;
    }
});
2reactions
rikschenninkcommented, Aug 27, 2018

Hi, just published version 2.1.0 of the core filepond library, can you install that instead of 2.0.1.

The onerror callback on the process object should then receive your JSON string {"filepond":["The filepond must be a file of type: audio\/mpeg."]}.

You can now set a function to a label property. The error object received by that function will contain the information returned by the process onerror callback.

labelFileProcessingError: (error) => {
    console.log(error);
    return 'My server errored';
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change error message into warning ... - SAP Community
I recently used OBA5 to change F5 117 message into an error for all users (except for one). We tested in MIRO/FB60 and...
Read more >
Is it possible to modify error messages based on the status of ...
No. I would like to check if the error has a status of 500 and then to overwrite the message to something more...
Read more >
Change Required Message Text - Alchemer Help
Click on the language for which you wish to change the text and go to the Messages tab. Scroll to the Page Error....
Read more >
Solved: Is it possible to change error message? - ServiceNow
Solved: Hi all, When no role user try to see the knowledge article which workflow is Pending Retirement, the error message appeared on...
Read more >
Error Messages: Examples, Best Practices & Common Mistakes
4 common mistakes with error messages · 1. Ambiguity · 2. Condescending language/blaming the user · 3. Poor placement of error messages ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found