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

Throw helpful error when project for given number cannot be found #35

Closed
4 of 5 tasks
gr2m opened this issue Mar 21, 2022 · 3 comments
Closed
4 of 5 tasks

Throw helpful error when project for given number cannot be found #35

gr2m opened this issue Mar 21, 2022 · 3 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers Pull Request welcome

Comments

@gr2m
Copy link
Owner

gr2m commented Mar 21, 2022

Please avoid duplicates

Reproducible test case

No response

Please select the environment(s) that are relevant to your bug report

  • Browsers
  • Node
  • Deno

Versions

1.3.2

What happened?

When running e.g. project.items.list() but the project cannot be found, an unhelpful error is currently thrown.

github-project/api/lib/get-state-with-project-items.js:32
    projectNext.fields.nodes
                ^

TypeError: Cannot read properties of null (reading 'fields')
    at getStateWithProjectItems (github-project/api/lib/get-state-with-project-items.js:32:17)
    at async listItems (github-project/api/items.list.js:13:26)
    at async updateMemex (file:///Users/gregor/code/github/how-we-work-booster-pack/scripts/update-memex.js:88:17)
    at async run (file:///Users/gregor/code/github/how-we-work-booster-pack/scripts/update-memex.js:62:5)

Would you be interested in contributing a fix?

  • yes
@gr2m gr2m added bug Something isn't working good first issue Good for newcomers Pull Request welcome labels Mar 21, 2022
@RohithSurya
Copy link

Hi @gr2m, I would like to work on the issue.

I reviewed the code and added a try/catch block when accessing the project.

I changed the listitems function for error handling:
Screenshot 2023-09-30 at 7 24 54 PM

This would fix the issue, I believe.
Can I get your thoughts on this too? 😊

@gr2m
Copy link
Owner Author

gr2m commented Oct 2, 2023

Code looks good, but instead of instantiating GitHubProjectError, I would create a new error class specific to this error, like we do for other errors as well.

@gr2m
Copy link
Owner Author

gr2m commented Oct 5, 2023

hey sorry I needed this fixed and totally forgot that you were working on it :( It's done via

Would you maybe like to work on any of the other open issues with a Pull Request welcome label? I'd happy to give you guidance.

Really sorry about this!

@gr2m gr2m closed this as completed Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers Pull Request welcome
Projects
None yet
Development

No branches or pull requests

2 participants