-
Notifications
You must be signed in to change notification settings - Fork 204
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
Show timeout errors on the frontend #2838
Changes from all commits
cb409e3
aeb9481
4107ff9
0082026
d9bcbda
c203249
30932d2
268a773
c573afa
8f6ac08
fdfe1f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,9 +14,6 @@ | |
:related-to="relatedTo" | ||
/> | ||
</ol> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When there is an error, |
||
<h5 v-if="isError && !fetchState.isFinished" class="py-4"> | ||
{{ fetchState.fetchingError }} | ||
</h5> | ||
<footer v-if="!isSinglePage" class="pt-4"> | ||
<VLoadMore /> | ||
</footer> | ||
|
@@ -43,8 +40,6 @@ import VGridSkeleton from "~/components/VSkeleton/VGridSkeleton.vue" | |
import VLoadMore from "~/components/VLoadMore.vue" | ||
import VImageCell from "~/components/VImageCell/VImageCell.vue" | ||
|
||
import type { NuxtError } from "@nuxt/types" | ||
|
||
export default defineComponent({ | ||
name: "ImageGrid", | ||
components: { VGridSkeleton, VLoadMore, VImageCell }, | ||
|
@@ -64,7 +59,7 @@ export default defineComponent({ | |
required: true, | ||
}, | ||
fetchState: { | ||
type: Object as PropType<FetchState | FetchState<NuxtError>>, | ||
type: Object as PropType<FetchState>, | ||
required: true, | ||
}, | ||
imageGridLabel: { | ||
|
@@ -76,13 +71,12 @@ export default defineComponent({ | |
const searchStore = useSearchStore() | ||
|
||
const searchTerm = computed(() => searchStore.searchTerm) | ||
const isError = computed(() => props.fetchState.fetchingError !== null) | ||
|
||
const relatedTo = computed(() => { | ||
return props.isSinglePage ? useRelatedMediaStore().mainMediaId : null | ||
}) | ||
|
||
return { isError, searchTerm, relatedTo } | ||
return { searchTerm, relatedTo } | ||
}, | ||
}) | ||
</script> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,45 @@ | |
|
||
export const NO_RESULT = "NO_RESULT" | ||
export const SERVER_TIMEOUT = "SERVER_TIMEOUT" | ||
export const ECONNABORTED = "ECONNABORTED" | ||
|
||
export const errorCodes = [NO_RESULT, SERVER_TIMEOUT] as const | ||
export const ERR_UNKNOWN = "ERR_UNKNOWN" | ||
|
||
export const customErrorCodes = [ | ||
NO_RESULT, | ||
SERVER_TIMEOUT, | ||
ECONNABORTED, | ||
ERR_UNKNOWN, | ||
] as const | ||
|
||
/** | ||
* The error codes Axios uses. | ||
* @see https://github.com/axios/axios/blob/9588fcdec8aca45c3ba2f7968988a5d03f23168c/lib/core/AxiosError.js#L57C2-L71 | ||
*/ | ||
Comment on lines
+20
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any chance this list could change? Is there any way to reference it directly in Axios? 😮 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could change, but there is no way of importing the list of error kinds directly from Axios :( |
||
const axiosErrorCodes = [ | ||
"ERR_BAD_OPTION_VALUE", | ||
"ERR_BAD_OPTION", | ||
"ECONNABORTED", | ||
"ETIMEDOUT", | ||
"ERR_NETWORK", | ||
"ERR_FR_TOO_MANY_REDIRECTS", | ||
"ERR_DEPRECATED", | ||
"ERR_BAD_RESPONSE", | ||
"ERR_BAD_REQUEST", | ||
"ERR_CANCELED", | ||
"ERR_NOT_SUPPORT", | ||
"ERR_INVALID_URL", | ||
] as const | ||
|
||
export const errorCodes = [...customErrorCodes, ...axiosErrorCodes] as const | ||
|
||
export const clientSideErrorCodes: readonly ErrorCode[] = [ | ||
ECONNABORTED, | ||
SERVER_TIMEOUT, | ||
NO_RESULT, | ||
ERR_UNKNOWN, | ||
"ERR_NETWORK", | ||
"ETIMEDOUT", | ||
] as const | ||
|
||
export type ErrorCode = (typeof errorCodes)[number] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prop will be removed in #2811, so I set a default value for it to avoid computing it.