fix error messages and add a method for creating exceptions
Added support for %p and moved type detection into PrintFormat (closes #98)