apollographql / router

A configurable, high-performance routing runtime for Apollo Federation 🚀
https://www.apollographql.com/docs/router/
Other
793 stars 266 forks source link

feat: use specific `Error` type in `__ExecutableBuilder::start` #3232

Open nmoutschen opened 1 year ago

nmoutschen commented 1 year ago

Is your feature request related to a problem? Please describe.

At the moment, __ExecutableBuilder::start uses anyhow::Result<()> as its return type. This means that a custom binary using the apollo-router as a library cannot infer why Apollo Router fails to start, short of parsing the result manually, and without guarantee that new error types won't emerge in new versions.

Describe the solution you'd like

__ExecutableBuilder::start should return a Result<(), StartError>, with StartError being an enum containing different error type variants. E.g.:

enum StartError {
    InvalidConfig(..),
    InvalidSchema(..),
    SchemaNotFound(..),
    // ...
}

Describe alternatives you've considered

Additional context Add any other context or screenshots about the feature request here.

BrynCooke commented 12 months ago

Let's see if we can get a design for the structured error messages and see where we stand.