import { useLogout } from '@/presentation/hooks' ; import { AccessDeniedError } from '@/domain/errors' ; type CallBackType = ( error : Error ) => void ; type ResultType = CallBackType ; export const useErrorHandler = ( callback ) : ResultType => { const logout = useLogout ( ) ; return ( error ) : void => { if ( error instanceof AccessDeniedError ) { logout ( ) ; } else { callback ( error ) ; } } ; } ;