Better error handling

Signed-off-by: Vishal Rana <vr@labstack.com>