Fix parameter extraction fails when path ends with '?'
Catch exceptions for afterRoute()