Skip to content

Error types

Genkit knows about two specialized types: GenkitError and UserFacingError. GenkitError is the base error type for Genkit errors. UserFacingError is intended for your code and is created using NewPublicError. The separation between these two error types helps you better understand where your error is coming from.

Using NewPublicError allows a web framework handler to know it is safe to return the message in a request. Other kinds of errors will result in a generic 500 message to avoid the possibility of internal exceptions being leaked to attackers.