  Dust attenuation affects nearly all observational aspects of galaxy
evolution, yet very little is known about the form of the dust-attenuation law
in the distant Universe. Here, we model the spectral energy distributions
(SEDs) of galaxies at z = 1.5--3 from CANDELS with rest-frame UV to near-IR
imaging under different assumptions about the dust law, and compare the amount
of inferred attenuated light with the observed infrared (IR) luminosities. Some
individual galaxies show strong Bayesian evidence in preference of one dust law
over another, and this preference agrees with their observed location on the
plane of infrared excess (IRX, $L_{\text{TIR}}/L_{\text{UV}}$) and UV slope
($\beta$). We generalize the shape of the dust law with an empirical model,
$A_{\lambda,\delta}=E(B-V)\ k_\lambda\ (\lambda/\lambda_V)^\delta$ where
$k_\lambda$ is the dust law of Calzetti et al. (2000), and show that there
exists a correlation between the color excess ${E(B-V)}$ and tilt $\delta$ with
${\delta=(0.62\pm0.05)\log(E(B-V))}$+ ${(0.26~\pm~0.02)}$. Galaxies with high
color excess have a shallower, starburst-like law, and those with low color
excess have a steeper, SMC-like law. Surprisingly, the galaxies in our sample
show no correlation between the shape of the dust law and stellar mass,
star-formation rate, or $\beta$. The change in the dust law with color excess
is consistent with a model where attenuation is caused by by scattering, a
mixed star-dust geometry, and/or trends with stellar population age,
metallicity, and dust grain size. This rest-frame UV-to-near-IR method shows
potential to constrain the dust law at even higher ($z>3$) redshifts.
