Conversation
| await expect( | ||
| Promise.all([client.sendTextMessage("!foo:bar", "a body", "txn1"), httpBackend.flush("/txn1", 1)]), | ||
| ).rejects.toThrow("MatrixError: [500] Unknown message"); | ||
| ).rejects.toThrow("MatrixError: [500] Ruh roh"); |
There was a problem hiding this comment.
I'm surprised this wasn't caught before, but seems to me this has always been a bug.
| * @returns Promise which resolves: to an ISendEventResponse object | ||
| * @returns Rejects: with an error response. | ||
| * @throws May throw a `MatrixSafetyError` if content is deemed unsafe. | ||
| * @see MatrixSafetyError |
There was a problem hiding this comment.
Reviewer, you may be wondering "Why has Half-Shot written a bunch of @ see MatrixSafetyError statements randomly across the file".
The intention here is to match the MSC's list of endpoints that may emit this error. I felt it was sensible to alert client developers that these endpoints may confer a specific error type if the user is trying to search or send harmful content, as oppose to usual failures.
I'm on the fence about overall usefulness, and could be persuaded they are overkill. However, it's done now so I'm going to leave unless noises are made.
The MSC or this PR (ie. should this be a draft?) |
Let me check with @turt2live on whether he is happy about the stability of the MSC for this to land. |
@turt2live says it's "probably fine" for this to be merged :) |
|
can confirm - the MSC is a bit in flux, but the changes here are stable enough. Worst case is the exact endpoints which get this treatment changes. |
Implementation of MSC4387.