Move common raise parameters to a function