forked from FoundKeyGang/FoundKey
client: improve error message on failed upload
Changelog: Fixed Ref: https://github.com/misskey-dev/misskey/issues/8574
This commit is contained in:
parent
4fbbfff145
commit
3a73f2c3de
2 changed files with 13 additions and 2 deletions
|
@ -233,6 +233,9 @@ resetAreYouSure: "Really reset?"
|
|||
saved: "Saved"
|
||||
messaging: "Chat"
|
||||
upload: "Upload"
|
||||
uploadFailed: "Upload failed"
|
||||
uploadFailedDescription: "The file could not be uploaded."
|
||||
uploadFailedSize: "The file is too large to be uploaded."
|
||||
keepOriginalUploading: "Keep original image"
|
||||
keepOriginalUploadingDescription: "Saves the originally uploaded image as-is. If turned\
|
||||
\ off, a version to display on the web will be generated on upload."
|
||||
|
|
|
@ -83,10 +83,18 @@ export function uploadFile(
|
|||
// TODO: 消すのではなくて再送できるようにしたい
|
||||
uploads.value = uploads.value.filter(x => x.id !== id);
|
||||
|
||||
let text = i18n.ts.uploadFailedDescription;
|
||||
if (xhr.status == 413) {
|
||||
// the file was too large
|
||||
text = i18n.ts.uploadFailedSize;
|
||||
} else if (xhr.response?.error?.message != null) {
|
||||
text = xhr.response?.error?.message;
|
||||
}
|
||||
|
||||
alert({
|
||||
type: 'error',
|
||||
title: 'Failed to upload',
|
||||
text: `${JSON.stringify(ev.target?.response)}, ${JSON.stringify(xhr.response)}`,
|
||||
title: i18n.ts.uploadFailed,
|
||||
text,
|
||||
});
|
||||
|
||||
reject();
|
||||
|
|
Loading…
Reference in a new issue