Avoid console errors when current document is showing?


I’m working through an interesting challenge. I’m creating the ability for a user to remove a post they’ve created, in which I re-route to their homepage on success or log an error to the console on failure. It all works perfectly, except I get a long error stream dumped in the console when the post is removed since the current route is looking for the post but it’s not there anymore and the user isn’t yet on the their homepage. What’s the easiest way to prevent this from happening, other than surrounding every variable on the page that uses post data with an “if” block?

Any thoughts would be appreciated.