refactor parser
retrieve error code and manage error