Added check for error obj before accessing message.