This sounds like it should throw a custom exception from within the code that other programs can catch. So if you just catch enay exception for now the final fix (custom exception) should work as well.