Network failure while building

In preparation of my build I install some packages with apt-get install -y. Now, I had a build, which was green, but should’ve failed due to a network problem, while fetching some packages via apt-get. My wild guess is, that the exit code isn’t recognized in this case; or am I missing something?
The apt-get commands are being executed through a shell script.