This guide explains how to customize the way errors are serialized in Goa services. Error serialization is the process of converting error objects into a format that can be transmitted over HTTP or gRPC to clients. This is especially important for validation errors since they are automatically generated by Goa using a specific error type and cannot be customized at creation time - only their serialization can be controlled.
Overview
When an error occurs in your Goa service, it needs to be converted into a format that clients can
understand. The most common case where you need custom error formatting is for validation errors,
which are automatically generated by Goa and always use the ServiceError
type. You cannot change
how these errors are created, but you can control how they are formatted in the response.