add writeerrorstring test, update doc