cobalt.rs icon indicating copy to clipboard operation
cobalt.rs copied to clipboard

Error messages need to be a lot more descriptive

Open MHohenberg opened this issue 6 years ago • 4 comments

Error: serve command failed
Caused by: Failed to render for "impressum.html"
Caused by: Failed to render layout "default.liquid"
Caused by: liquid: Invalid index
  with:
     index=page

What does that even mean? As a user, how do I know where to look, what I did wrong, how to fix this? Given that the help section of the website isn't too helpful in this case either, it appears I am stuck - and will lose some work by having to get back to an earlier commit.

Even using the --debug parameter does not give more useful information.

This should never be the case. Please make error messages somewhat descriptive.

MHohenberg avatar May 12 '18 06:05 MHohenberg

This looks like an undefined variable page was used within the default.liquid layout when trying to create the impressum.html page.

If that is the problem, could you give more detail about what more you want or what should be different?

epage avatar May 12 '18 13:05 epage

It's all so easy if you know what you're doing ;) Indeed, I had a typo in that template.

I guess the problem is that unless you know what "index=page" means, it does not really describe what the problem is. Especially "index=page" is - given that page may refer to the page object, the resulting webpage, several different other things - relatively confusing.

(What did contribute to my confusion is that the error only appeared when I updated from 0.11.something to 0.12.something)

Maybe it'd be good to have something more descriptive, like "Unknown object page.publisheddate" or something along the lines.

MHohenberg avatar May 12 '18 16:05 MHohenberg

I was wondering if that was the part you were going to identify; I just didn't want to bias the response.

This does seem like something that could be drastically improved. I've already made a huge improvement in error reporting already by reporting the context.

  • So this says "index" because I didn't specialize the code for root objects and leaf objects.
  • Tags give a decent amount of context for unknown variables but directly accessing variables does not. As you mentioned, giving the extra context like that would be a big help.

epage avatar May 12 '18 18:05 epage

(What did contribute to my confusion is that the error only appeared when I updated from 0.11.something to 0.12.something)

Thats odd. I can see getting this when switching from 0.10 to 0.12 but not sure why upgrading from 0.11 would have this problem. If you have the time / patience to look into what happened, it'd hep to see if a bug was introduced.

epage avatar May 12 '18 18:05 epage