Custom post type

Hello,

Is it possible to redirect a custom article archive page to page 404, if it does not contain any articles?

Not sure if that is the best for SEO UX. Maybe it would be better to have some code on the archive page to let the user know that there aren’t any articles?