function x = internal_errorOnComplexGradientBackward(x, errorMessage)
% This function is undocumented and will change in a future release.

%   Copyright 2021 The MathWorks, Inc.

if ~isreal(x)
    error(message(errorMessage{:}));
end