Skip to content

Improve error handling for no archiver empty cycle info #61

@chrypnotoad

Description

@chrypnotoad

When getting archiver stats if the archiver has no cycleinfo it is an empty array and fails with a not very useful error undefined => undefined

When this is most likely to happen is when starting up a local network if you start the RPC before the network is processing you get this error. This could be logged more gracefully

Unreachable Archiver @ 127.0.0.1:4000 | Error-code: undefined => undefined

const res = await axios.get(`http://${url.ip}:${url.port}/cycleinfo/1`)
if (res?.data?.cycleInfo[0].counter > maxCycleValue) {
maxCycleValue = res?.data?.cycleInfo[0].counter
}
return { url: `http://${url.ip}:${url.port}`, cycle_value: res?.data?.cycleInfo[0].counter }
} catch (error: unknown) {
console.error(
`Unreachable Archiver @ ${url.ip}:${url.port} | Error-code: ${(error as NodeJSError).errno} => ${
(error as NodeJSError).code
}`
)
return { url: `http://${url.ip}:${url.port}`, cycle_value: null }

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions