Is there a reason ParsingError isn't public? #311
-
I'm working on a project that can accept input as either a file or as input on STDIN, and I'm encountering some frustrating problems parsing the inputs. I'm sure it has to do with newlines, but it's getting frustrating to keep trying to add them in some cases and see what happens, then remove them and see what happens, &c. It's tiresome. Now, the parser is definitely throwing a ParsingError. My parse call is alone in a } catch {
print("Error parsing input: \(error.localizedDescription)")
} ...and sure enough, the console output looks like:
I'd like to drill down into that error, but because ParsingError isn't public in swift-parsing version 0.13.0, I can't get specific on my catch block like: } catch Parsing.ParsingError {
print("Parsing error: \(error.debugDescription)")
} catch {
print("Some weird error: \(error.localizedDescription)"
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
@sbeitzel The main reason it's not That said, we don't want to prevent folks from working with the library as you want to, so maybe we should put |
Beta Was this translation helpful? Give feedback.
@sbeitzel The main reason it's not
public
is because we don't feel the API is ready yet. While it's much much better than not having errors at all, we still have some things to learn and want some license to change things in the future.That said, we don't want to prevent folks from working with the library as you want to, so maybe we should put
ParsingError
under a public@_spi(Errors)
? We probably won't have time to do this right away, but if you are up to PR this change, I think we'd happily take a look and merge things.