File tree Expand file tree Collapse file tree 11 files changed +48
-38
lines changed
Expand file tree Collapse file tree 11 files changed +48
-38
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,15 @@ const getGithubIssueLink = computed(() => {
5151 <Text v-if =" error?.statusCode == 404" size =" 16" weight =" 500" color =" secondary" >
5252 {{ error?.statusMessage }}
5353 </Text >
54+ <!-- <Flex v-if="error?.statusCode == 404" direction="column" gap="6">
55+ <Text size="16" weight="500" color="secondary">
56+ {{ error?.statusMessage }}
57+ </Text>
58+
59+ <Text v-if="error?.data?.value" size="16" weight="500" color="secondary">
60+ {{ error?.statusMessage }}
61+ </Text>
62+ </Flex> -->
5463 <Text v-else size =" 16" weight =" 500" color =" secondary" > Unknown Error </Text >
5564
5665 <Text
Original file line number Diff line number Diff line change @@ -18,18 +18,18 @@ const route = useRoute()
1818const router = useRouter ()
1919
2020const address = ref ()
21- const hash = route . params . hash . startsWith ( " 0x " ) ? route . params . hash . slice ( 2 ) : route . params . hash
22- if (isValidId (hash, " address" )) {
23- const { data: rawAddress } = await fetchAddressByHash (hash)
21+
22+ if (isValidId (route . params . hash , " address" )) {
23+ const { data: rawAddress } = await fetchAddressByHash (route . params . hash )
2424
2525 if (! rawAddress .value ) {
26- router . push ( " / " )
26+ throw createError ({ statusCode : 404 , statusMessage : ` Address ${ route . params . hash } not found ` } )
2727 } else {
2828 address .value = rawAddress .value
2929 cacheStore .current .address = address .value
3030 }
3131} else {
32- router . push ( " / " )
32+ throw createError ({ statusCode : 404 , statusMessage : ` Address ${ route . params . hash } not found ` } )
3333}
3434
3535defineOgImageComponent (" AddressImage" , {
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ const route = useRoute()
2020const block = ref ()
2121
2222if (! isValidId (route .params .height , " block" )) {
23- navigateTo ( " / " )
23+ throw createError ({ statusCode : 404 , statusMessage : ` Block ${ route . params . height } not found ` } )
2424}
2525
2626const { data: rawBlock } = await fetchBlockByHeight (route .params .height )
Original file line number Diff line number Diff line change @@ -9,13 +9,12 @@ import { IbcChainName } from "@/services/constants/ibc"
99import { fetchIbcChainsStats } from " @/services/api/stats"
1010
1111const route = useRoute ()
12- const router = useRouter ()
1312
1413const { data } = await useAsyncData (` ibc-chains` , () => fetchIbcChainsStats ({ limit: 100 }))
1514const chain = ref (data .value .find ((c ) => c .chain === route .params .id ))
1615
1716if (! chain .value ) {
18- router . push ( " / " )
17+ throw createError ({ statusCode : 404 , statusMessage : ` IBC chain ${ route . params . id } not found ` } )
1918}
2019
2120useHead ({
Original file line number Diff line number Diff line change @@ -14,21 +14,20 @@ import { useCacheStore } from "@/store/cache.store"
1414const cacheStore = useCacheStore ()
1515
1616const route = useRoute ()
17- const router = useRouter ()
1817
1918const namespace = ref ()
2019
2120if (isValidId (route .params .id , " namespace" )) {
2221 const { data: rawNamespace } = await fetchNamespaceByID (route .params .id )
2322
2423 if (! rawNamespace .value ) {
25- router . push ( " / " )
24+ throw createError ({ statusCode : 404 , statusMessage : ` Namespace ${ route . params . id } not found ` } )
2625 } else {
2726 namespace .value = rawNamespace .value [0 ]
2827 cacheStore .current .namespace = namespace .value
2928 }
3029} else {
31- router . push ( " / " )
30+ throw createError ({ statusCode : 404 , statusMessage : ` Namespace ${ route . params . id } not found ` } )
3231}
3332
3433defineOgImageComponent (" NamespaceImage" , {
Original file line number Diff line number Diff line change @@ -16,13 +16,12 @@ const appStore = useAppStore()
1616const cacheStore = useCacheStore ()
1717
1818const route = useRoute ()
19- const router = useRouter ()
2019
2120const rollup = ref ()
2221const { data: rawRollup } = await fetchRollupBySlug (route .params .slug )
2322
2423if (! rawRollup .value ) {
25- router . push ( " /networks " )
24+ throw createError ({ statusCode : 404 , statusMessage : ` Network ${ route . params . slug } not found ` } )
2625} else {
2726 rollup .value = rawRollup .value
2827 patchRollupColor ()
Original file line number Diff line number Diff line change @@ -92,6 +92,10 @@ async function fetchData() {
9292 fetchRollupRankingBySlug (slug),
9393 ])
9494
95+ if (! rollupData? .data ? .value ) {
96+ throw createError ({ statusCode: 404 , statusMessage: ` Network ${ slug} not found` })
97+ }
98+
9599 let description = []
96100 for (const [key , value ] of Object .entries (rankData? .scores )) {
97101 const category = getMetricCategory (key, value)
@@ -244,7 +248,7 @@ const handleHowItWorksClick = () => {
244248watch(
245249 () => page.value,
246250 async () => {
247- repos.value = await getRollupRepos(rollup.value.slug)
251+ repos.value = await getRollupRepos(rollup.value? .slug)
248252 },
249253)
250254
Original file line number Diff line number Diff line change @@ -22,27 +22,29 @@ if (isValidId(route.params.id, "proposal")) {
2222 const { data: rawProposal } = await fetchProposalById ({ id: route .params .id })
2323
2424 if (! rawProposal .value ) {
25- navigateTo ({
26- path: " /" ,
27- query: {
28- error: " not_found" ,
29- target: " proposal" ,
30- id: route .params .id ,
31- },
32- })
25+ throw createError ({ statusCode: 404 , statusMessage: ` Proposal ${ route .params .id } not found` })
26+ // navigateTo({
27+ // path: "/",
28+ // query: {
29+ // error: "not_found",
30+ // target: "proposal",
31+ // id: route.params.id,
32+ // },
33+ // })
3334 } else {
3435 proposal .value = rawProposal .value
3536 cacheStore .current .proposal = proposal .value
3637 }
3738} else {
38- navigateTo ({
39- path: " /" ,
40- query: {
41- error: " not_found" ,
42- target: " proposal" ,
43- id: route .params .id ,
44- },
45- })
39+ throw createError ({ statusCode: 404 , statusMessage: ` Proposal ${ route .params .id } not found` })
40+ // navigateTo({
41+ // path: "/",
42+ // query: {
43+ // error: "not_found",
44+ // target: "proposal",
45+ // id: route.params.id,
46+ // },
47+ // })
4648}
4749
4850defineOgImageComponent (" ProposalImage" , {
Original file line number Diff line number Diff line change @@ -14,20 +14,19 @@ import { useCacheStore } from "@/store/cache.store"
1414const cacheStore = useCacheStore ()
1515
1616const route = useRoute ()
17- const router = useRouter ()
1817
1918const tx = ref ()
2019const hash = route .params .hash .startsWith (" 0x" ) ? route .params .hash .slice (2 ) : route .params .hash
2120if (isValidId (hash, " tx" )) {
2221 const { data: rawTx } = await fetchTxByHash (hash)
2322 if (! rawTx .value ) {
24- router . push ( " / " )
23+ throw createError ({ statusCode : 404 , statusMessage : ` Transaction ${ route . params . hash } not found ` } )
2524 } else {
2625 tx .value = rawTx .value
2726 cacheStore .current .transaction = tx .value
2827 }
2928} else {
30- router . push ( " / " )
29+ throw createError ({ statusCode : 404 , statusMessage : ` Transaction ${ route . params . hash } not found ` } )
3130}
3231
3332defineOgImageComponent (" TxImage" , {
Original file line number Diff line number Diff line change @@ -13,20 +13,19 @@ import { useCacheStore } from "@/store/cache.store"
1313const cacheStore = useCacheStore ()
1414
1515const route = useRoute ()
16- const router = useRouter ()
1716
1817const validator = ref ()
1918if (isValidId (route .params .id , " validator" )) {
2019 const { data: rawValidator } = await fetchValidatorByID (route .params .id )
2120
2221 if (! rawValidator .value ) {
23- router . push ( " / " )
22+ throw createError ({ statusCode : 404 , statusMessage : ` Validator ${ route . params . id } not found ` } )
2423 } else {
2524 validator .value = rawValidator .value
2625 cacheStore .current .validator = validator .value
2726 }
2827} else {
29- router . push ( " / " )
28+ throw createError ({ statusCode : 404 , statusMessage : ` Validator ${ route . params . id } not found ` } )
3029}
3130
3231defineOgImageComponent (" ValidatorImage" , {
You can’t perform that action at this time.
0 commit comments