Add and use function to create internal errors.