added the managmento of the exception when calling setHandler

Change-Id: I65ba8b8c2f43dfe22072ee5b37185b32af128a69