You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
User would have access to a second parameter, the original diagnostic printer, thus allowing them to tap into diagnostics without giving the defaults up.
// throw on error diagnosticsonDiagnostic(diagnostic,printer){telemetry.send(diagnostic)printer.print(diagnostic)}
There is a lot of room to play with the printer api. For example maybe it has the built in concept of throwing:
Nexus currently and newly has behaviour of:
Discussion with @tgriesser led to following proposal:
Here's my stab at a draft spec
New callback
onDiagnostic
Have an undocumented global function
nexusNotify
to avoid threading state through the codebase for messaging.The
onDiagnostic
callback would receive aDiagnostic
type.This would be structured data about something. In the abstract:
Concretely using this case as an example https://github.com/graphql-nexus/schema/blob/481e2c77fea61213b011d21659359fa425cefc55/src/utils.ts#L389.
The
code
would have the following benefits:onDiagnostic
into a discriminant union for great autocompletion/data discovery/type safetyhttps://nxs.li
shortlinks to link to an index of diagnostics with additional detail and guides/guide links.When user supplies own
onDiagnostic
it would remove Nexus' default one.User could throw if they wish to enforce checks in CI
User would have access to a second parameter, the original diagnostic printer, thus allowing them to tap into diagnostics without giving the defaults up.
There is a lot of room to play with the
printer
api. For example maybe it has the built in concept of throwing:The name
diagnostic
is taken from TypeScript terminology.The text was updated successfully, but these errors were encountered: