-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Endpoint compilation errors point to initialize()
method on Scala 3
#141
Comments
the |
@bishabosha, I think the macro is already reporting the error with an explicit position When I try a similar example, I get this error:
So it appears that the inner error is somehow hidden in the examples above. Could it be an issue with the way the editor displays the errors? On a side note, I think the error message definitely has room for improvement "can't convert X to a response" is not very useful. When I ported the macro to scala3, I didn't make this a priority, but I think it would be nice to detail what the expected response type actually is, and also include the implicit lookups that were attempted. |
I could reproduce the error without cask and opened a bug report on the scala3 repository: scala/scala3#21666 |
As an alternative solution. we could simply also include the method's position in the error message. This way it's at least obvious what part of the code is logically causing the error, regardless of the position of the actual compile error. For example, here's a quick snippet to replace in the above mentioned macro: report.error(s"error in route definition `def ${method.name}` (at ${method.pos.get}): the method's return type ${rtp.show} cannot be converted to the expected endpoint response type ${innerReturnedTpt.show}", method.pos.get) with this change, the error message would look something like this:
|
I think reporting the method position in the error message would be great, that way we get both the One issue would be whether it works nicely in IDEs, but the command-line terror report should be great |
the bits from the inline stack trace can be included as |
This includes more information in the error message that is generated when a route declaration has an invalid return type. It notably also includes the source position, as discussed in #141.
Going to call this done thanks to #145, should be available as 0.10.1 |
The text was updated successfully, but these errors were encountered: