For example, if the response error content is {“message”:“File size exceeds the maximum allowed size”} within getResponseError, I want to retrieve the detailed error message “File size exceeds the maximum allowed size”, but using error.message only returns “Upload error”.
How can I access the specific error message returned later in the code?
let uppy = new Uppy.Uppy();
uppy.use(Uppy.Dashboard, {
inline: true
, bundle: true
, height: 500
, width: 900
, target: '#uppy'
, method: 'post'
})
.use(Uppy.XHRUpload, {
endpoint: 'server.php',
getResponseError(content, xhr) {
return JSON.parse(content);
}
})
uppy.on('upload-error', (file, error) => {
const errorMessage = error.message;
console.error('Upload error:', errorMessage);
});