Simplify code to set message on TypeError error

when method not found or property not a method