Open joss-enet opened 1 year ago
DAP specifies the format is required. So I think the method signature should change to be an overload:
protected sendErrorResponse(response: DebugProtocol.Response, message: DebugProtocol.Message)
protected sendErrorResponse(response: DebugProtocol.Response, code: number, format: string, variables?: Record<string, any>, dest: ErrorDestination = ErrorDestination.User)
protected sendErrorResponse(response: DebugProtocol.Response, codeOrMessage: number | DebugProtocol.Message, format?: string, variables?: any, dest: ErrorDestination = ErrorDestination.User) {
...
}
thoughts @roblourens?
Agree
As an example, the following code would send an error:
The error in question:
Uncaught Error Error: TypeError: Cannot read properties of undefined (reading 'replace')
This is due to the method sendErrorResponse() calling formatPII() even though no format is passed to the former. The solution adopted was to assign an empty string as the format if none was passed as an argument. Another solution could be to make the format argument mandatory.