Formalize NSError userInfo keys and remove category.

Libraries shouldn't add categories to Foundation classes. Use a helper function
instead.