Unify creation of errorMsg and textMsg
Unify creation of errorMsg and textMsg

Moved to a function to remove duplicated code.

tchx84/turtleblocksjs,tradzik/turtleblocksjs,Daksh/turtleblocksjs,Daksh/turtleblocksjs,tradzik/turtleblocksjs,garyservin/turtleblocksjs,hemantkasat/turtleblocksjs,garyservin/turtleblocksjs,walterbender/turtleblocksjs,i5o/turtleblocksjs,hemantkasat/turtleblocksjs,hemantkasat/turtleblocksjs,tchx84/turtleblocksjs,rodibot/turtleblocksjs,rodibot/turtleblocksjs,tradzik/turtleblocksjs,i5o/turtleblocksjs,walterbender/turtleblocksjs,Daksh/turtleblocksjs,garyservin/turtleblocksjs,i5o/turtleblocksjs,rodibot/turtleblocksjs,walterbender/turtleblocksjs,tchx84/turtleblocksjs