mirror of https://github.com/zulip/zulip.git
d053e07760
The first argument to the error callback is *usually* a string code from a list in the filedrop source; but sometimes it was the text the server sent in the HTTP status line, instead. The latter isn't predictable, and so it's not possible to write app code that uses it to handle error consistently. Instead, use that parameter for the numeric HTTP status code. This still isn't totally clean in that sometimes it's internal filedrop errors, as strings, and sometimes it's HTTP status codes, as numbers; but at least both of those are things we can sanely handle with a `switch` statement. Also pass through `serverResponse`, which for a nice JSON error from the server will contain meaningful information about the error which the calling code can use for nice error handling. And just drop the HTTP status text, which at best is redundant with the numeric code. In passing, fix one case where for no obvious reason filedrop was passing the file object but not the index. This should be a pure refactor. |
||
---|---|---|
.. | ||
assets | ||
audio | ||
generated | ||
html | ||
icons/fonts | ||
images | ||
js | ||
locale | ||
styles | ||
swagger | ||
templates | ||
third | ||
ts | ||
.gitignore | ||
favicon.ico | ||
node_modules |