Open cheneveld opened 8 years ago
Great questions. I think ApiModel should come with some sort of default error handling, perhaps the rails format it expects today. Customizing error messages and parsing probably goes hand-in-hand with https://github.com/erkie/ApiModel/issues/14.
I'm not sure about the usefulness of persisting errors and error messages on disk. What's your envisioned use-case?
By standardized error json do you mean to make it configurable? That does sound pretty smart. I wonder if it should be handled in parsers though. The hard-coded error message that's there now does not scale very well...
https://github.com/erkie/ApiModel/pull/31makes a clear distinction between the types of errors
This PR -> https://github.com/erkie/ApiModel/pull/29, shows how validation errors are lost. But the question is who should own knowning what a validation error means? ApiModel or the implementer?
Should ApiModel conform to standard rails json for errors?
Should ApiModel Objects contain virtual (or realmed) errors?
Should Server error json be standardized? as to populate the error message from json instead of hardcoded default errror message seen here -> https://github.com/AdeptMobile/ApiModel/blob/6e33fa9aaa4143bf9a7ee9ab0ebf9d4d0141671b/Tests/ApiFormTests.swift#L84
Food for thought.