SCTX-1334: Add exception handlers

In response to code review with djs55

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>