You can always measure the energy of the particle.
When the particle's wavefunction $\psi(x)$ is not an eigenfunction
$\psi_i(x)$ of the Hamiltonian, it can still be written
as a linear combination of such eigenfunctions.
$$\psi(x) = \sum_i c_i \psi_i(x)$$
When you now measure the energy of this state, the result
is not unique. Instead, you can get any energy eigenvalue
$E_i$ as the result, each with probability $|c_i|^2$.
This is called Born's rule.
This rule contains as a special case the behavior when the wave
function $\psi(x)$ happens to be an eigenfunction $\psi_i(x)$.
Then one of the $|c_i|^2$ is $1$ and all the others are $0$.
This means you get one eigenvalue $E_i$ with certainty (i.e.
with $100$% probability), while you do not (i.e. with $0$
probability) get any of the other eigenvalues.