Change getConstantValue to throw an exception on error, not return null