-
Notifications
You must be signed in to change notification settings - Fork 595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make parsing methods (Uri etc) more user friendly (or/and document exceptions etc) #1276
Comments
Another possible option which is more clear than inline scaladoc text is the scaladoc |
What about offering safe methods that return a |
Yeah, also an option. That doesn't cover multiple heterogenous exceptions well though. |
I think it's exactly in these cases that having compiler support with throws clauses as Java has is useful - though I think one could have the best of both worlds by allowing organizations to decide whether they want to stick to that discipline and annotate a project somehow that they always declare exceptions. Not that this is something that can be decided here, but perhaps it can be referenced by an appropriate issue in another relevant forum when and if it comes up. From a developer point of view compiler support for declared exceptions is really helpful. Otherwise, the developer has to dig through the code... |
Let's not go into language design and pros/cons of checked exceptions here ;-) What I think is rather being asked for here is to take a second look at various parsing APIs and make them more user-friendly. They're mostly used internally where we value speed of getting a value out over the nice-to-use-nees, so exceptions won there. Perhaps adding versions I'll change the title to be about that, it's also more actionable that way. |
I think it's quite undisputed to use I cannot really remember why that wasn't done here. One reason could be that part of those APIs was used internally and we wanted to avoid extra wrapping there but it might also just have been an oversight. |
It makes sense to also have a URL parsing method that throws exceptions for when this is used in code where a large number of URLs have to be parsed and most of them parse well. |
Yeah, and I realized that we have all kinds of usages like |
Sprung out of a discussion on gitter: https://gitter.im/akka/akka?at=5964806d4bcd78af569a46ff
Not sure about this one, but would it be better if for example the
parse
methods onUri
in addition to docs had the Scala@throws
annotation detailing what exception they throw? (I don't think we have much methods throwing on the Akka core side of things so that's why I'm opening the issue here rather).There might be more places where failure handling is done through exceptions, maybe the marshalling infra, that should have the same problem?
The text was updated successfully, but these errors were encountered: