Improve urlSecurityCheck(): throw errors with stack trace