handling exceptions in constructor