I'm curious about how Drupal 8 handles nodes 404 requests. I think there might be a route of 404 and then an internal check - if node id doesn't exists, it simply calls 404 route path.
If this scenario is right, how can I achieve the same for custom entity?
I have a content entity type, but want a 404 redirection if someone access wrong entity id directly similar to any node page which doesn't exists.