Check in refactoring code for using exception handling for device
service