Section 27. If, on premises abutting on a public way, an excavation is a hazard to travelers upon such way who are in the exercise of due care, the person in control of such premises shall be liable in tort to any such traveler who, by reason of a want of a sufficient railing or barrier in or upon such excavation or between such excavation and such way, sustains bodily injury or property damage.