So we used this catch-all feature here,
but currently there is one problem,
if you wanna call it like this.
Whenever we enter something invalid here,
like too many POV segments, we see that fall back text.
Now that's actually not necessarily a problem.
We might be fine with that,
but we also might want to actually show an error
instead if invalid POV segments were entered here.
and we could implement this
by going back to the page.js file here.
And then, right before returning this content,
this JSX content, we could add a if check
and check if we have a selected year
and the available news years
do not include this selected year.
So the available news years will give us an array.
Do not include the selected year,
which we check by using the includes method
and adding an exclamation mark in front of this.
So now if we have a selected year,
but it's not part of the available years,
we'll make it into this if block.
And in here, I want to throw a new error
where I'll say "invalid filter."
And that's not the only way of ending up
with an invalid filter.
Because besides this condition,
there also is another alternative condition
that should throw an error.
So I'll add a logical or here
and then I'll check if we maybe have a selected month
and that selected month is not part of the available months.
So if not get available news months
and we have to pass the selected year to the news month,
if that array does not include the selected month,
that's the alternative condition.
So if one of these two conditions,
this condition or this condition,
if one of these two conditions is met,
we make it in there and throw an error.
And actually here we have to be careful
because the years and months,
these utility functions will return,
will actually be of type number.
So we'll get back numbers here.
Whereas the selected years
and months which we extract from the path,
the URL path will be of type string.
Here it says any. but it will be strings.
And includes therefore would actually return false
since we have a type mismatch,
even if it's the same kind of value that's stored.
So we should actually convert selected year to a number here
and also selected month here
to make sure that we don't get an error in situations
where we shouldn't get it.
But with those changes made, you'll see that if you visit,
for example, a valid year, that works.
If you visit a valid year-month combination, that works.
But if I enter invalid month,
I get this default development mode error overlay.
And if I enter some arbitrary paths,
potentially also too many POV segments,
I also get this error overlay.
Now of course,
I don't want to get that development error overlay,
but instead my own error page
and therefore, we should now also add error handling here.