This makes the rename file dialog code to report errors correctly.
Probably will fix other file managing issues.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>
r.upload.addEventListener('progress', config.onUploadProgress);
}
+ // This event gets triggered on *any* server response
r.addEventListener('load', () => {
- if (r.status === 404) {
+ if (r.status >= 400) {
return reject(r);
} else {
return resolve(r);
}
});
+ // This event gets triggered on network errors
r.addEventListener('error', () => {
return reject(r);
});
dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'File name changed.', hideDuration: 2000 }));
} catch (e) {
const errors: FormErrors<RenameFileDialogData, string> = {
- name: 'Could not rename the file'
+ name: `Could not rename the file: ${e.responseText}`
};
dispatch(stopSubmit(RENAME_FILE_DIALOG, errors));
}
component={TextField}
autoFocus={true}
/>
- <WarningCollection text="Renaming a file will change content address." />
+ <WarningCollection text="Renaming a file will change the collection's content address." />
</>;