mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
chore: Clarify error messages.
This commit is contained in:
committed by
Joachim Van Herwegen
parent
82f90709a6
commit
ba40374c66
@@ -92,10 +92,10 @@ class WebSocketListener extends EventEmitter {
|
||||
// Resolve and verify the URL
|
||||
const resolved = new URL(path, `${this.protocol}${this.host}`);
|
||||
if (resolved.host !== this.host) {
|
||||
throw new Error(`Mismatched host: ${resolved.host} instead of ${this.host}`);
|
||||
throw new Error(`Mismatched host: expected ${this.host} but got ${resolved.host}`);
|
||||
}
|
||||
if (resolved.protocol !== this.protocol) {
|
||||
throw new Error(`Mismatched protocol: ${resolved.protocol} instead of ${this.protocol}`);
|
||||
throw new Error(`Mismatched protocol: expected ${this.protocol} but got ${resolved.protocol}`);
|
||||
}
|
||||
// Subscribe to the URL
|
||||
const url = resolved.href;
|
||||
|
||||
@@ -101,7 +101,7 @@ describe('An UnsecureWebSocketsProtocol', (): void => {
|
||||
it('send an error message.', (): void => {
|
||||
expect(webSocket.messages).toHaveLength(1);
|
||||
expect(webSocket.messages.shift())
|
||||
.toBe('error Mismatched host: wrong.example instead of mypod.example');
|
||||
.toBe('error Mismatched host: expected mypod.example but got wrong.example');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -113,7 +113,7 @@ describe('An UnsecureWebSocketsProtocol', (): void => {
|
||||
it('send an error message.', (): void => {
|
||||
expect(webSocket.messages).toHaveLength(1);
|
||||
expect(webSocket.messages.shift())
|
||||
.toBe('error Mismatched protocol: http: instead of https:');
|
||||
.toBe('error Mismatched protocol: expected https: but got http:');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user