implemented exception passing to result