By default, the Marten::Handlers::Defaults::Debug::ServerError handler (which is called when an unhandled exception is raised in development) displays only the message of the showcased exception, which does not help much in case of Marten::DB::Errors::InvalidRecord exceptions (which are raised when trying to save invalid model records).
Let's implement a special case in order to ensure that validation error details are surfaced for these exceptions in this debug page. In this light, we could probably iterate over the error set (instance of Marten::Core::Validation::ErrorSet) for the considered record and display for each error the corresponding field and message.
Description
By default, the
Marten::Handlers::Defaults::Debug::ServerError
handler (which is called when an unhandled exception is raised in development) displays only the message of the showcased exception, which does not help much in case ofMarten::DB::Errors::InvalidRecord
exceptions (which are raised when trying to save invalid model records).Let's implement a special case in order to ensure that validation error details are surfaced for these exceptions in this debug page. In this light, we could probably iterate over the error set (instance of
Marten::Core::Validation::ErrorSet
) for the considered record and display for each error the corresponding field and message.