Safe api errors

Please see info & comments at https://github.com/learningequality/ka-lite/pull/420
Please add comments here.