This is correct if you want to catch only the first warning/error. If you wanted to collect every error (until an unrecoverable one is found), you would need a custom error handling that collects the errors so you can get all of them after parsing.