improving error handling

added parse_token//2 error handler