Add more error codes and message, reflow some doc comments.