Added exception class and started to throw exceptions in code