-
Notifications
You must be signed in to change notification settings - Fork 1
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
#90: Added logging to services #119
Conversation
Server/src/services/track.service.ts
Outdated
@@ -124,7 +127,11 @@ export default class TrackService { | |||
|
|||
// for easier access we set the property of track kilometer to the already calculated value | |||
if (projectedPoint.properties["location"] == null) { | |||
// TODO: log this | |||
logger.error( | |||
`Turf did something wrong while computing nearest point on line for track with id ${ |
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.
Maybe rather something like: Turf error: Could not compute nearest point on line for track with id ... and position ...
Server/src/services/track.service.ts
Outdated
@@ -209,7 +222,11 @@ export default class TrackService { | |||
// this gives us the nearest point on the linestring including the distance to that point | |||
const closestPoint: GeoJSON.Feature<GeoJSON.Point> = nearestPointOnLine(lineStringData, position) | |||
if (closestPoint.properties == null || closestPoint.properties["dist"] == null) { | |||
// TODO: this should not happen, so maybe log this | |||
logger.warn( | |||
`Turf did not calculate nearest point on line correctly for position ${JSON.stringify( |
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.
Same as above:
Turf error: Could not calculate nearest point on line correctly for position ${JSON.stringify(position)} for track with id {tracks[i].uid}.
I think it is just easier to read that this error lies in turf, not our implementation.
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 was not thinking too much about this as this check should prevent typescript from complaining (the properties
-field is optional in GeoJSON) rather than really handling any errors there. I guess turf would throw an error instead of setting properties
to null
anyways. But you are right, that the log messages are a little bit vague. So I will change this (thanks for the suggestions for those).
I just pushed the requested changes, but you may noticed I also added the correct type to the variables, which store the result of turf's |
No description provided.