-
Notifications
You must be signed in to change notification settings - Fork 3
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
Conversation
b39c317
to
d6c78de
Compare
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
d6c78de
to
490b960
Compare
@@ -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'; |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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