[Someone want to comment on where this global variable gets set and to what good uses one can put it to?]

RS: Contains the error message and traceback of the last error. Silly example:

 % proc foo {} {bar x}
 % proc bar {input} {grill$input}
 % foo
 invalid command name "grillx"
 % set errorInfo
 invalid command name "grillx"
    while executing
    (procedure "bar" line 1)
    invoked from within
 "bar x"
    (procedure "foo" line 1)
    invoked from within

See also errorCode, magic variables

Note that information is only added to the error trace for errors. Other kinds of result (including user-defined exception codes) do not cause the backtrace to be built.