@wolfstar/http-framework 6.3.1 → 6.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +5 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -2763,21 +2763,22 @@ function makeInteraction(response, interaction) {
|
|
|
2763
2763
|
}
|
|
2764
2764
|
}
|
|
2765
2765
|
/**
|
|
2766
|
-
* Handles a received error.
|
|
2767
|
-
* interaction was not replied to.
|
|
2766
|
+
* Handles a received error.
|
|
2768
2767
|
*
|
|
2769
2768
|
* This function has a special case for string errors, which are translated to a
|
|
2770
2769
|
* regular message with content as the error.
|
|
2771
2770
|
*
|
|
2772
2771
|
* When an error is thrown, the error is emitted in client, and a generic error
|
|
2773
|
-
* message is sent back to Discord
|
|
2772
|
+
* message is sent back to Discord, unless the response was already ended or
|
|
2773
|
+
* closed (the interaction was answered before the error was thrown): writing to
|
|
2774
|
+
* it again would emit an unhandled `ERR_STREAM_WRITE_AFTER_END`.
|
|
2774
2775
|
* @param response The HTTP request we can response to.
|
|
2775
2776
|
* @param error The error to handle.
|
|
2776
2777
|
* @returns The response object.
|
|
2777
2778
|
*/
|
|
2778
2779
|
function handleError(response, error) {
|
|
2779
2780
|
container$1.client.emit("error", error);
|
|
2780
|
-
if (!container$1.client.httpReplyOnError || response.closed) return response;
|
|
2781
|
+
if (!container$1.client.httpReplyOnError || response.writableEnded || response.closed) return response;
|
|
2781
2782
|
response.statusCode = 500;
|
|
2782
2783
|
return response.end(ErrorMessages.InternalError);
|
|
2783
2784
|
}
|