refactor(minErr): remove duplicated code

Note: references to internal APIs were removed in commits 8425e9f and 94764ee but
angular.toJson is still used.