Improve error message for invalid literals

@tgoyne 

Addresses #752