diff --git a/src/components/Advertisements/core/AdvertisementRegister/AdvertisementRegister.tsx b/src/components/Advertisements/core/AdvertisementRegister/AdvertisementRegister.tsx index 44216c8761..d9ad01e258 100644 --- a/src/components/Advertisements/core/AdvertisementRegister/AdvertisementRegister.tsx +++ b/src/components/Advertisements/core/AdvertisementRegister/AdvertisementRegister.tsx @@ -117,9 +117,11 @@ function advertisementRegister({ }); handleClose(); } - } catch (error) { - toast.error('An error occured, could not create new advertisement'); - console.log('error occured', error); + } catch (error: unknown) { + if (error instanceof Error) { + toast.error(error.message); + console.log(error.message); + } } }; const handleUpdate = async (): Promise => { @@ -181,8 +183,11 @@ function advertisementRegister({ refetch(); handleClose(); } - } catch (error: any) { - toast.error(error.message); + } catch (error: unknown) { + if (error instanceof Error) { + toast.error(error.message); + console.log(error.message); + } } }; return ( diff --git a/src/screens/OrganizationActionItems/OrganizationActionItems.tsx b/src/screens/OrganizationActionItems/OrganizationActionItems.tsx index 2fdb63a93c..3c5a083e32 100644 --- a/src/screens/OrganizationActionItems/OrganizationActionItems.tsx +++ b/src/screens/OrganizationActionItems/OrganizationActionItems.tsx @@ -123,9 +123,11 @@ function organizationActionItems(): JSX.Element { actionItemsRefetch(); hideCreateModal(); toast.success(t('successfulCreation')); - } catch (error: any) { - toast.error(error.message); - console.log(error.message); + } catch (error: unknown) { + if (error instanceof Error) { + toast.error(error.message); + console.log(error.message); + } } }; diff --git a/src/screens/OrganizationDashboard/OrganizationDashboard.tsx b/src/screens/OrganizationDashboard/OrganizationDashboard.tsx index 628d104276..e6f6f5bd9c 100644 --- a/src/screens/OrganizationDashboard/OrganizationDashboard.tsx +++ b/src/screens/OrganizationDashboard/OrganizationDashboard.tsx @@ -103,7 +103,7 @@ function organizationDashboard(): JSX.Element { useEffect(() => { if (errorOrg || errorPost || errorEvent) { - console.log('error', errorPost); + console.log('error', errorPost?.message); navigate('/orglist'); } }, [errorOrg, errorPost, errorEvent]);