function b execption handling