Problem or motivation
I just started to integrate this lib into some Nuxt projects and it fits very well, so I want to thank you for such a great thing.
However, in some cases I missed possibility to pass more data through createError to the client side - now it allows to put just a limited set of parameters, such as cause, fix, etc.
Proposed feature
Enhance ErrorOptions passed to createError with extra object parameter (or maybe there's better name for it), which can include custom data passed to the client side.
Plus, sometimes it would be good to allow to pass the cause not only as Error object, but maybe as H3Error.
Possible implementation (optional)
Make ErrorOptions interface as follows:
interface ErrorOptions<DataT = unknown, ErrorT = Error> {
...
/** The original error that caused this */
cause?: ErrorT;
/** Additional data to be included in response */
extra?: DataT
}
and to make ErrorLog to include that additional data.
Alternatives you’ve considered (optional)
No response
Problem or motivation
I just started to integrate this lib into some Nuxt projects and it fits very well, so I want to thank you for such a great thing.
However, in some cases I missed possibility to pass more data through
createErrorto the client side - now it allows to put just a limited set of parameters, such ascause,fix, etc.Proposed feature
Enhance
ErrorOptionspassed tocreateErrorwithextraobject parameter (or maybe there's better name for it), which can include custom data passed to the client side.Plus, sometimes it would be good to allow to pass the
causenot only as Error object, but maybe asH3Error.Possible implementation (optional)
Make
ErrorOptionsinterface as follows:and to make
ErrorLogto include that additional data.Alternatives you’ve considered (optional)
No response