Improve error message when scriptInfo is missing in mapTextChangeToCodeEdit#28258
Conversation
src/server/editorServices.ts
Outdated
|
|
||
| /* @internal */ | ||
| allScriptInfoFileNamesForDebug(): ReadonlyArray<string> { | ||
| return arrayFrom(this.filenameToScriptInfo.keys()); |
Member
There was a problem hiding this comment.
I think we should have both filename and path print instead of just path to figure out if there is mismatch in casing that could cause this.
Author
There was a problem hiding this comment.
So the keys of filenameToScriptInfo are paths and not filenames? I was assuming the key to this map was the same as the value's .fileName property?
sheetalkamat
reviewed
Nov 2, 2018
src/server/editorServices.ts
Outdated
| return scriptInfo.getDefaultProject(); | ||
| } | ||
| else { | ||
| this.logger.msg(`Cannot find ${fileName} in ${JSON.stringify(this.allScriptInfoFileNamesForDebug)}`, Msg.Err); |
Member
There was a problem hiding this comment.
Needs to be this.allScriptInfoFileNamesForDebug()
sheetalkamat
reviewed
Nov 2, 2018
src/server/editorServices.ts
Outdated
| /* @internal */ | ||
| allScriptInfoFileNamesForDebug(): ReadonlyArray<{ readonly path: string, readonly fileName: string }> { | ||
| const out: { readonly path: string, readonly fileName: string }[] = []; | ||
| this.filenameToScriptInfo.forEach((scriptInfo, path) => { |
sheetalkamat
reviewed
Nov 2, 2018
src/server/session.ts
Outdated
| return symLinkedProjects ? { projects: projects!, symLinkedProjects } : projects!; // TODO: GH#18217 | ||
| } | ||
|
|
||
| private logErrorForScriptInfoNotFound(fileName: string): void { |
Member
There was a problem hiding this comment.
Move this to editorServices and use it in all locations?
sheetalkamat
approved these changes
Nov 2, 2018
Member
sheetalkamat
left a comment
There was a problem hiding this comment.
Need to update API as the build will fail without it but everything else is good.
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Should help diagnose #28233
Putting the text in a log message instead of in the exception text to avoid putting PII in exception text.