try catch for lineplot