// Writing C++ code
static shutdown(){
try{
// Code that we need to check if it throws exception, which is not discussed //in question
}catch(e){
// e will have a value if the exception is thrown
if(e == ProductionInProgressException)
this.reset();
}