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

changes for adoptions/likes error fixing #88

Merged
merged 2 commits into from
Apr 9, 2022

Conversation

zoobot
Copy link
Member

@zoobot zoobot commented Apr 7, 2022

WORKING: existing db trees from cities that exist, TODO: add trees from cities not in db

minor progress with errors

working but could use some more error checking

working but errors are returning early if the pg-promise error handler used

@zoobot zoobot force-pushed the zoobot/feature/new-vector-tiles branch 2 times, most recently from b39c317 to d6c78de Compare April 8, 2022 06:55
WORKING: existing db trees from cities that exist, TODO: add trees from cities not in db

minor progress with errors

working but could use some more error checking

working but errors are returning early if the pg-promise error handler used

33 day long geojson data, until next vector tile send

missing notes
@zoobot zoobot force-pushed the zoobot/feature/new-vector-tiles branch from d6c78de to 490b960 Compare April 9, 2022 19:03
@zoobot zoobot merged commit 3838b19 into development Apr 9, 2022
@zoobot zoobot deleted the zoobot/feature/new-vector-tiles branch April 9, 2022 19:05
@@ -8,7 +8,7 @@ import morgan from 'morgan';
import dotenv from "dotenv";
import logger from '../logger.js';
import unknownEndpointHandler from './middleware/unknown-endpoint-handler.js';
import expressErrorHandler from './middleware/express-error-handler.js';
// import expressErrorHandler from './middleware/express-error-handler.js';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A number of lines below are commented out as well, and presumably can be removed.

@@ -9,7 +9,9 @@ export async function findTreeAdoptionsByTreeId(id) {
WHERE id = $1;
`;
const values = [id];
const treeAdoptions = db.manyOrNone(query, values);
const treeAdoptions = db.manyOrNone(query, values)
.then(data => data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for? Looks like a noop.

const treeAdoptions = db.manyOrNone(query, values);
const treeAdoptions = db.manyOrNone(query, values)
.then(data => data)
.catch(error => error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is swallowing any errors, preventing them from being handled anywhere else. Shouldn't they be logged, at least?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It returns them. This was the only way I could get the errors passed back to the FE and is what the docs say to do. yes seems wierd. We should open another PR to investigate the PG-Promise error handling. The PG-promise error handler in index is responding pre-emptively. Jason mentioned we should change some of these to manyOrNone as well. Will open an issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's very strange. Can't really see how it could have any effect, since it's just returning exactly what it received to the next handler in the chain.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree its strange. I've seen stuff like this before where you want to solely use async await but it doesn't actually return what you want unless you use then, catch. I don't know what is the deal with it, some kind of undecided jankiness of js oldschool/new school promise handling? Feel free to investigate PGPromise error handler because that is confusing as well! I opened an issue.

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

Successfully merging this pull request may close these issues.

None yet

2 participants