Add return statements and exception handling

In the function handleEvent added additional return statements what
allows not to perform additional checks. Empty catch statements are
filled. Try/catch blocks are added where necessary.

Change-Id: I6dd13f14d97d7e75e65f56bad211889112b6cef8