add Error handling code

to method configTimeToLiveInSeconds to check the range of $ttl