Skip to content

Commit

Permalink
Added Custom sound error message
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-malviya15 committed Feb 18, 2022
1 parent 3a47726 commit 8468e34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions client/views/admin/customSounds/AddCustomSound.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ function AddCustomSound({ goToNew, close, onChange, ...props }) {
return soundId;
}
validation.forEach((error) => {
throw new Error({
type: 'error',
message: t('error-the-field-is-required', { field: t(error) }),
});
throw new Error(t('error-the-field-is-required', { field: t(error) }));
});
},
[dispatchToastMessage, insertOrUpdateSound, t, uploadCustomSound],
Expand All @@ -73,7 +70,7 @@ function AddCustomSound({ goToNew, close, onChange, ...props }) {
goToNew(result)();
onChange();
} catch (error) {
dispatchToastMessage({ type: 'error', message: error });
dispatchToastMessage({ type: 'error', message: error.message });
}
}, [dispatchToastMessage, goToNew, name, onChange, saveAction, sound, t]);

Expand Down
2 changes: 1 addition & 1 deletion client/views/admin/customSounds/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function validate(soundData, soundFile) {

export function createSoundData(soundFile, name = '', previousData) {
const soundData = {
extension: soundFile.name.split('.').pop(),
extension: soundFile?.name.split('.').pop(),
};

if (previousData) {
Expand Down

0 comments on commit 8468e34

Please sign in to comment.