Build successfull even with unsuccessfull install script

Wilhelm Berg's Avatar

Wilhelm Berg

05 Mar, 2014 01:58 PM

I use a Powershell install script.
During the script an exception occurs and I want to stop the build.
I've tried Break and Exit but the build is still reported as successful.


How can I stop the build when an exception occurs?

  1. 1 Posted by Wilhelm Berg on 05 Mar, 2014 02:14 PM

    Wilhelm Berg's Avatar

    [SOLVED] Just re-throw the exception and the build stops.

    PowerShell script is considered successful if it's finished without exception. []

  2. Support Staff 2 Posted by Feodor Fitsner on 05 Mar, 2014 05:58 PM

    Feodor Fitsner's Avatar

    Thanks for the update!

  3. 3 Posted by Wilhelm Berg on 20 Aug, 2014 11:09 AM

    Wilhelm Berg's Avatar

    Now I'm having the same problem with .BAT files.

    I'm calling several .BAT files from my yml.

    Error catching in the BAT files looks like this (appreviated):


    However, execution does not stop.

    How can I stop the build, when an error orrcurs?

  4. Support Staff 4 Posted by Feodor Fitsner on 20 Aug, 2014 02:34 PM

    Feodor Fitsner's Avatar

    Will take a look.—
    Sent from Mailbox

  5. Support Staff 5 Posted by Feodor Fitsner on 21 Aug, 2014 03:25 AM

    Feodor Fitsner's Avatar

    I'm afraid there is a problem with your .bat. You setting %ERRORLEVEL% back to 0 with the last cd.

    My test results:

    1. Demonstrating that ERRORLEVEL works:
    2. Simulating your case:
    3. This is how to fix script (copy ERRORLEVEL to a different variable next to failing command):
  6. 6 Posted by Wilhelm Berg on 21 Aug, 2014 10:39 AM

    Wilhelm Berg's Avatar

    Ohhh, of course.
    Thanks a bunch.

    It's always the same:
    quick-won't-do-any-harm-last-minute-changes break everything.

  7. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:47 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac