You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error while parsing response from server: NIOIMAPCore.ParserError(hint: "none of the options match", file: "NIOIMAPCore/Parser/Grammar/GrammarParser.swift", line: 147)
In this case, I think the actual error is that base64-decoding fails. But oneOf throws away useful error information:
staticfunc oneOf<T>(_ subParsers:[SubParser<T>], buffer:inoutByteBuffer, tracker:StackTracker, file:String=(#file), line:Int= #line)throws->T{
for parser in subParsers {do{returntrycomposite(buffer:&buffer, tracker: tracker, parser)}catch is ParserError{
continue
}}throwParserError(hint:"none of the options match", file: file, line: line)}
The text was updated successfully, but these errors were encountered:
Don't backtrack if a subparser consumed any input. This ensures that the most relevant error is returned.
Provide a default error to oneOf that's used if no subparsers consumed any input or use the error from the last subparser. (If you do the latter, you can use an always-failing subparser to provide a better error at your discretion.)
elm/parser does (1) but returns a list of errors instead of (2). Haskell's parsec library also works this way.
This approach is also faster since it avoids needless backtracking. But it may require some adjustments to the parser.
When parsing fails, the errors are pretty rough.
Take this example:
In this case, I think the actual error is that base64-decoding fails. But
oneOf
throws away useful error information:The text was updated successfully, but these errors were encountered: