add ns_error xsh function, use it in all tools