Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Show 404 page when requested image id doesn't exist #50

Merged
merged 2 commits into from
Apr 29, 2021

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Apr 29, 2021

Fixes #46

The fetch method in photos/_id.vue dispatches two actions concurrently: to fetch the current image, and the related images. If the image fetch action in the store throws an error, it is re-thrown and handled within the fetch method. The fetch method was rewritten to use the nuxt context variables instead of this so that we could use the standard error method:

catch (err) {
      error({
        statusCode: 404,
        message: app.i18n.t('error.image-not-found', { id: route.params.id }),
      })
    }
```

@obulat obulat requested review from zackkrida and dhruvkb April 29, 2021 11:12
Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

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

Very nice improvements all around, including the new error namespace in the translation strings. Thank you!

@zackkrida zackkrida merged commit 2b485ed into WordPress:develop Apr 29, 2021
@zackkrida zackkrida deleted the image_not_found branch April 29, 2021 15:12
@zackkrida zackkrida added ✨ goal: improvement Improvement to an existing user-facing feature 🕹 aspect: interface Concerns end-users' experience with the software labels Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🕹 aspect: interface Concerns end-users' experience with the software ✨ goal: improvement Improvement to an existing user-facing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: No 404 error on nonexistient image
3 participants