improved error handling, when secrets are wrong
better using Error objects instead of simple strings
simplified getValueAsText()