Skip to content
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

Hard to identify the reason of an error #22

Open
eduardo-vortx opened this issue Jan 10, 2022 · 5 comments
Open

Hard to identify the reason of an error #22

eduardo-vortx opened this issue Jan 10, 2022 · 5 comments
Labels
enhancement New feature or request hacktoberfest help wanted Extra attention is needed severity-major Item is very important

Comments

@eduardo-vortx
Copy link

Is your feature request related to a problem? Please describe.

Working on a project, I spent a good couple of hours strugling with a mistake I made.

In a scenario where a property of an entity is an array of another entity, like the image below:

image

And that entity is the response of my usecase:

image

If I push an object that isn't an entity (does not implements BaseEntity), it throws an error at runtime:

image

image

Describe the solution you'd like

It would be nice to have a better error message, telling the developer he is pushing the wrong object to that array.
The example I created is very simple, so it's easier to identify the problem. But when I faced this problem, I was on a larger code base, so it took me a lot of time to understand what was going on.

Describe alternatives you've considered

Herbs is written in JS, so it's hard to handle this kind of errors because it only happens at runtime.

Thinking about the problem, may it would be possible to identify this by using Proxies on entity properties, so we can intercept the changes in the object and print a more specific message on the console.

Additional context

I created a minimal herbs project showing how to emulate the same problem.

@eduardo-vortx eduardo-vortx added the enhancement New feature or request label Jan 10, 2022
@jhomarolo jhomarolo added severity-major Item is very important help wanted Extra attention is needed labels Jan 15, 2022
@jhomarolo
Copy link
Contributor

Hi @eduardo-vortx, thanks for your contribution.

Did you think about any solutions (in a tech way) for this issue yet?

@italojs
Copy link
Member

italojs commented Feb 14, 2022

Why not just fix the error? 🤷🏻‍♂️

@italojs
Copy link
Member

italojs commented May 4, 2022

@eduardo-vortx this issue stil alive?

@jhomarolo
Copy link
Contributor

@italojs this issue is not about fixing the error. It is about showing us that it is hard to find the error.

@jhomarolo
Copy link
Contributor

@eduardo-vortx did you tried to use herbs audit inside the env?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest help wanted Extra attention is needed severity-major Item is very important
Projects
Status: More discussion is needed
Development

No branches or pull requests

3 participants