Added some error handling to posts route