Bug 501128

Summary: Unknown Error message when canceling export and overwrite
Product: [Applications] krita Reporter: Tyson Tan <tysontanx>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: halla
Priority: NOR    
Version First Reported In: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Unknown Error when canceling export and overwrite

Description Tyson Tan 2025-03-06 04:15:17 UTC
Created attachment 179167 [details]
Unknown Error when canceling export and overwrite

Krita displays an Unknown Error message when canceling an export and overwrite dialogue. Tested with krita-5.3.0-prealpha-b22ece9db2-x86_64.AppImage (2025-03-06). I began to notice the issue around late February. 

Steps to reproduce:

1) Export a PNG
2) Choose an existing filename
3) When asked about overwriting, click Yes
4) Cancel exporting on the next dialogue

Krita then shows an error message: "Could not start saving PATH. Unknown failure has happened." A screenshot of this error is attached.
Comment 1 Tyson Tan 2025-03-06 04:20:31 UTC
I recall translating this error message a few months ago; it's quite new. Is the logic of this message possibly incorrect? I typically don't cancel an export process, which is why I didn't notice it sooner.
Comment 2 Halla Rempt 2025-03-06 10:09:35 UTC
Yes, something is wrong here.
Comment 3 Bug Janitor Service 2025-11-16 13:27:45 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/2531
Comment 4 Halla Rempt 2025-11-17 15:11:54 UTC
Git commit 2021dbb4514340a703c92b31d1ebdc1ebb38018c by Halla Rempt, on behalf of Joshua Goins.
Committed on 17/11/2025 at 15:11.
Pushed by rempt into branch 'master'.

Don't show an error when cancelling an export

If the file type prompts you before actually saving (for example, PNG)
it's still possible to cancel the export process. However the previous
logic considers this a failure, and will show a pretty unhelpful dialog
that there was an "unknown failure" while exporting your document.

Instead, lets treat it like a cancelled export which doesn't display a
dialog. startExportInBackground unfortunately doesn't provide enough
information to the callee since a boolean can only state if it was
successful or not, I chose to just bubble up the KisImageExportErrorCode
instead.

M  +11   -6    libs/ui/KisDocument.cpp
M  +1    -1    libs/ui/KisDocument.h
M  +2    -1    libs/ui/KisImportExportUtils.h

https://invent.kde.org/graphics/krita/-/commit/2021dbb4514340a703c92b31d1ebdc1ebb38018c
Comment 5 Tyson Tan 2025-11-18 00:44:25 UTC
Thank you Halla and Joshua! :)