Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper message to created share not found #26688

Merged
merged 2 commits into from
Oct 13, 2021

Conversation

skjnldsv
Copy link
Member

@skjnldsv skjnldsv commented Apr 22, 2021

Otherwise the extend of the GenericShareException replace with a completely unrelated and cryptic message

class GenericShareException extends HintException {
/**
* @param string $message
* @param string $hint
* @param int $code
* @param \Exception|null $previous
* @since 9.0.0
*/
public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) {
if (empty($message)) {
$message = 'There was an error retrieving the share. Maybe the link is wrong, it was unshared, or it was deleted.';
}

@skjnldsv
Copy link
Member Author

/backport to stable21

@skjnldsv
Copy link
Member Author

/backport to stable20

@skjnldsv
Copy link
Member Author

/backport to stable19

@skjnldsv skjnldsv force-pushed the enh/better-share-exceptiondebug branch from b7bdbbf to 3612a10 Compare April 22, 2021 06:50
@@ -223,7 +223,7 @@ public function create(\OCP\Share\IShare $share) {
$cursor->closeCursor();

if ($data === false) {
throw new ShareNotFound();
throw new ShareNotFound('Newly created share could not be found');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this returned to the end user? Or is this just for the logs? I'm asking because of the potential need to translate this.

This comment was marked as resolved.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah no, this is actually read for the end user too.
But this is technical, if we reach this error the admin must know

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmmh ... but even then it should either be "there was an error - reach out to the admin" or a localized error message if the user can do something.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But yeah - it was untranslated before. So I will not block this because of the refined message. But we should look into this, because it is a HintException which will show the hint to the end user and print the message to the logs. (if no hint provided it uses the message)

So maybe we could add a generic and translated "Something broke" as hint and give this detailed message as internal message.

@skjnldsv
Copy link
Member Author

See #26716

This was referenced May 20, 2021
@blizzz blizzz mentioned this pull request Jun 2, 2021
57 tasks
@MorrisJobke MorrisJobke mentioned this pull request Jun 10, 2021
59 tasks
This was referenced Jun 16, 2021
@blizzz blizzz modified the milestones: Nextcloud 22, Nextcloud 23 Jun 24, 2021
@skjnldsv
Copy link
Member Author

/rebase

@skjnldsv skjnldsv requested review from a team and removed request for rullzer August 18, 2021 12:44
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
@skjnldsv skjnldsv mentioned this pull request Oct 13, 2021
@skjnldsv skjnldsv merged commit b585cf1 into master Oct 13, 2021
@skjnldsv skjnldsv deleted the enh/better-share-exceptiondebug branch October 13, 2021 09:41
@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Oct 13, 2021
@MichaIng
Copy link
Member

/backport to stable22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish bug feature: sharing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants