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

Detect and change all occurences where DB errors are not checked #231

Open
mattfullerton opened this issue Nov 10, 2016 · 0 comments
Open
Assignees

Comments

@mattfullerton
Copy link
Contributor

If a DB error results from a query, we should return an error in the request or cause an exception, e.g.

if (err) callback (err)

Instead of just carrying on regardless. Here's one suspicious occurrence:
https://github.com/NRGI/ResourceProjects.org/blob/master/server/controllers/source_tables.js#L83

Where in the logs we end up throwing an exception "Cannot read property 'company_established_source' of undefined" - it might be undefined because a DB error lead to no data being returned or might be undefined because there's a logic error in the code. In this particular instance there's also no check for whether the array has any objects before accessing item 0...

I would suggest searching for all occurrences of the term "function (err" in the controllers and checking them for error detection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants