Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upNice codegen errors #920
Comments
killercup
added
good first issue
enhancement
help wanted
tests
labels
May 22, 2017
added a commit
to DorianListens/diesel
that referenced
this issue
Jun 3, 2017
DorianListens
referenced this issue
Jun 3, 2017
Merged
Add error message for derive(Insertable) on empty struct #931
added a commit
to DorianListens/diesel
that referenced
this issue
Jun 4, 2017
This comment has been minimized.
jaroslaw-weber
commented
Aug 29, 2017
|
Error messages in diesel look too much like tokio errors - if you mistype or make a mistake it tends to throw out very long errors. although it is scary at first, fixing wasn't that difficult (just start at the top) |
This comment has been minimized.
|
Is there work left to be done on this issue? It looks like there are two merged pull requests, one of which specifically addresses |
This comment has been minimized.
berkus
commented
May 10, 2018
•
|
@willmurphyscode there's definitely more to be done:
in the recent diesel 1.2.2 and I have no clue what it's talking about. the struct in question for posterity:
Upd: it apparently blows on
I changed it to use |
This comment has been minimized.
|
Unfortunately, since syn always panics when something fails, there's nothing we can do to improve error messages as a result of giving invalid syntax. I've asked them to look into returning a result in the past (dtolnay/syn#7), but they are uninterested in doing so. I'd open an issue over there if you want to see movement on that front. I'm open to new issues if there's any specific places we can improve the error messages, but I think this can probably be closed at this point. |
killercup commentedMay 22, 2017
•
edited
Make sure our codegen (
#[derive(…)]) generates useful error messages. They should be tested by a compile-fail test.Especially edge cases like empty structs should be caught where necessary. For example,
currently fails with
It should probably say something like this instead (maybe with a link to docs or some other feature the user might've been meaning to use):
We already alert the user to some things, e.g. how we currently don't support generic structs, with code like this.
Feel free to add more examples in the comments.