fix typos in doc and add custom error type