More informative errors when publishing, fixing badge type

This adds (marginally) better error messages when an error occurs publishing a badge.

Also fixes an issue with reading the badge type of published/archived badges.