sql error trapping the restore command

But sometimes (intentionally) I specify a file that is either too young or
too old for the database
to restore. Essentially I am going through a series of files which need
applying. Some of them
are irrelevant. When one of these files is eno****ered the above command
yields

Error on Server:, Source:.Net SqlClient Data Provider
Class:16, Msg 4326, State 0, Line 36
The log in this backup set terminates at LSN 2565000000217200001, which is
too early to apply to the database. A more recent log backup that includes
LSN 2569000000078800001 can be restored.

The above error message is also fine. I simply now want to continue with the
rest of my sql commands.
But I cant seem to trap the error message so my script does NOT stop.