AppError.Internal
Overview
Internal returns a 500 AppError.
If you are coming from Node.js, the closest pattern is createError(500, msg).
Method on AppError — call it on a value of that type after constructing or receiving one from a constructor.
Signature
go
func Internal(message string) *AppErrorCompare: Node.js · Standard Go · gox
js
next(createError(500, 'internal'));go
return fmt.Errorf("%w: message", http.ErrInternal)go
import "github.com/sahilkhaire/gox/err"
return err.Internal("internal error")Example
go
import "github.com/sahilkhaire/gox/err"
return err.Internal("internal error")Tips
Obtain a AppError value first (see constructors on the package overview), then call Internal.
Standard library alternative
Use the standard library directly:
go
return fmt.Errorf("%w: message", http.ErrInternal)