Error handling when loading widget code