improve error handling for userscripts
improve error handling for userscripts

from https://github.com/python-diamond/Diamond/pull/536

Netuitive/netuitive-diamond,Netuitive/netuitive-diamond,Netuitive/netuitive-diamond,Netuitive/netuitive-diamond