improved coding style
changed to proper error object usage for throwing timeout error