-
Notifications
You must be signed in to change notification settings - Fork 304
Unify logging of errors during position conversions #1161
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
Unify logging of errors during position conversions #1161
Conversation
27d4c2c
to
a25b1d2
Compare
@swift-ci Please test |
a25b1d2
to
a499fa7
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
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.
Much cleaner 👍
Sources/SKSupport/LineTable.swift
Outdated
// Line out of range. | ||
logger.fault( | ||
""" | ||
Unable to get string index for \(line):\(utf16Column) because line is out of range \ |
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.
Probably obvious enough from the caller, but could help to add whether it's utf8 vs utf16 in all these messages. It's not super necessary for the line case, so maybe just add utf<n>
in front of column
for the column cases?
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.
Good idea 👍🏽
Instead of logging errors in position translation ad-hoc at the caller’s side (and ofter forgetting to do so), log these errors in `LineTable`. To be able to debug where the position conversion error is coming from, also log the file name and line number of the caller. rdar://125545620
a499fa7
to
d62c4ce
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
Instead of logging errors in position translation ad-hoc at the caller’s side (and ofter forgetting to do so), log these errors in
LineTable
. To be able to debug where the position conversion error is coming from, also log the file name and line number of the caller.