added exception

handles the exception when the sides are nonpositive