MCPcopy
hub / github.com/fastify/fastify / setErrorHandler

Function setErrorHandler

fastify.js:769–785  ·  fastify.js::setErrorHandler
(func)

Source from the content-addressed store, hash-verified

767
768 class="cm">// wrapper that we expose to the user for configure the custom error handler
769 function setErrorHandler (func) {
770 throwIfAlreadyStarted(class="st">'Cannot call "setErrorHandler"!')
771
772 if (typeof func !== class="st">'function') {
773 throw new FST_ERR_ERROR_HANDLER_NOT_FN()
774 }
775
776 if (!options.allowErrorHandlerOverride && this[kErrorHandlerAlreadySet]) {
777 throw new FST_ERR_ERROR_HANDLER_ALREADY_SET()
778 } else if (this[kErrorHandlerAlreadySet]) {
779 FSTWRN004()
780 }
781
782 this[kErrorHandlerAlreadySet] = true
783 this[kErrorHandler] = buildErrorHandler(this[kErrorHandler], func.bind(this))
784 return this
785 }
786
787 function setChildLoggerFactory (factory) {
788 throwIfAlreadyStarted(class="st">'Cannot call "setChildLoggerFactory"!')

Callers

nothing calls this directly

Calls 2

throwIfAlreadyStartedFunction · 0.85
buildErrorHandlerFunction · 0.85

Tested by

no test coverage detected