Allow passing controllers to error and notFound

This PR adds functionality to allow the user to pass a controller instead of a callable to notFound and error methods.

Adresses #741.