adding an error check in the build stage