> On 05 Jul 2015, at 14:19, Peter Uhnák <
[hidden email]> wrote:
>
> Would be possible for STON to report context for error?
> For example
>
> STON fromString: '[
> "first",
> "second",
> ]'
>
> reports "At character 23: invalid input" which is not very useful especially in longer strings.
> (at: 23 is actually Character cr)
>
> Maybe better would be something like
>
> 'At character 23: invalid input near "second", ]' so I already see the surrounding text (this is not perfect, but I find it very common for example to forget comma when moving things around in array.
Yes, the error handling is not very human oriented.
You could show the context yourself, showing input 10 positions before and after the indicated position where the parsing failed.
> Or even better, allow comma after the last item.
> (Arguably even JSON (unlike JavaScript) doesn't allow this so maybe it would break stuff.)
Like you said yourself, not a good idea.
> Peter