0

If I have multiple Codelines within a Try statement.

will it break me out as soon as 1 of them doesn't function?/through an error?

and if yes, will it ignore the rest of the code within the try statement that is written after the error?

Update:

I found this Thread which basically explains it as well Why is try {…} finally {…} good; try {…} catch{} bad?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
  • 4
    It depends on what type of error it comes across. The only exceptions that are caught, are the ones that are from *terminating* errors. Non-terminating errors will continue. You can also else specify when a command show be terminating using `-ErrorAction Stop`, or assigning *Stop* to the `$ErrorActionPreference` variable from the beginning, making every error terminating – Abraham Zinala Jun 22 '21 at 12:17
  • 2
    If the error is terminating, then the code after the throwing statement inside the `try` block will be skipped, yes. – Mathias R. Jessen Jun 22 '21 at 12:18

0 Answers0