I am thinking whether having
url tag that returns nothing when it cannot match any patterns wouldn’t be better choice than one that raises exception and prevents user from doing anything on page where this occurred?
This just happened to me yesterday, where I forgot to put one thing into the template context and it caused
url tag to give me a couple of 500s in production
I totally get that is MY problem and I should have been more careful and have better test coverage… Still if there were something like
safeurl tag as an alternative, I would be probably using it all the time. If it couldn’t match anything, then the
href would be empty - it wouldn’t work but the rest of the page would be more useful than having 500.
It could be paired with some sort of logging, so I would see in Sentry for example that there is invalid URL pattern being requested, but it wouldn’t bring down entire page.