Every dog owner has to face an accident because of their dogs; whether they brought a new puppy or giving house training to their dog to go out for a pee.
Unfortunately, it is not possible for your pet to go to a specific place for pee and mess.
You cannot get angry at them, as you have to learn and calm down yourself to deal with these situations.