Log exceptions while calling functions