Skip to content

Commit

Permalink
use throw error in place of dispatching new toastmessage
Browse files Browse the repository at this point in the history
  • Loading branch information
Dnouv committed Jan 16, 2023
1 parent a624a08 commit c58d09d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const AppReleases = ({ id }: { id: App['id'] }): ReactElement => {
const { apps } = await getVersions();

if (apps.length === 0) {
dispatchToastMessage({ type: 'error', message: t('No_results_found') });
throw new Error(t('No_results_found'));
}
return apps;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const CustomSoundsRoute = (): ReactElement => {
const { sounds } = await getSounds(query);

if (sounds.length === 0) {
dispatchToastMessage({ type: 'error', message: t('No_results_found') });
throw new Error(t('No_results_found'));
}
return sounds;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function EditCustomSound({ _id, onChange, ...props }: EditCustomSoundProps): Rea
const { sounds } = await getSounds({ query: JSON.stringify({ _id }) });

if (sounds.length === 0) {
dispatchToastMessage({ type: 'error', message: t('No_results_found') });
throw new Error(t('No_results_found'));
}
return sounds[0];
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const UsersInRoleTableWithData = ({
const { users } = await getUsersInRole(query);

if (users.length === 0) {
dispatchToastMessage({ type: 'error', message: t('No_results_found') });
throw new Error(t('No_results_found'));
}
return users;
},
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/views/admin/rooms/RoomsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const RoomsTable = ({ reload }: { reload: MutableRefObject<() => void> }): React
const { rooms } = await getAdminRooms(params);

if (rooms.length === 0) {
dispatchToastMessage({ type: 'error', message: t('No_results_found') });
throw new Error(t('No_results_found'));
}
return rooms;
},
Expand Down

0 comments on commit c58d09d

Please sign in to comment.