refactor way of handling exceptions
refactor way of handling exceptions