Closed selankon closed 1 month ago
FTR another way to do the same:
return Promise.allSettled(promises).then((results) => {
const success: IChainBlockInfoResponse[] = []
const errors: { index: number, error: any }[] = []
results.forEach((result, index) => {
if (result.status === "fulfilled") {
success.push(result.value)
} else {
// Capture 404 errors specifically
if (result.reason?.response?.status === 404) {
errors.push({ index, error: result.reason })
}
}
})
On this way we can create a more verbose output for not found blocks when trying to access them by
blockList
.This is not necessary at all since Gui told me that they are fixing the way of how old blocks will be indexed, so this should not be necessary anymore on the explorer. But, just in case, the change is not really big and we could use it from now and will prevent future pruned blocks that are not indexed properly.
The question here is if simply return a more generic error type (not only for the 404 blocks).