mirror of
https://github.com/kataras/iris.git
synced 2025-12-20 03:17:04 +00:00
minor
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
package errors
|
package errors
|
||||||
|
|
||||||
import "github.com/kataras/iris/v12/context"
|
import (
|
||||||
|
"github.com/kataras/iris/v12/context"
|
||||||
|
"github.com/kataras/iris/v12/macro/handler"
|
||||||
|
)
|
||||||
|
|
||||||
// DefaultPathTypeParameterErrorHandler registers an error handler for macro path type parameter.
|
// DefaultPathTypeParameterErrorHandler registers an error handler for macro path type parameter.
|
||||||
// Register it with Application.Macros().SetErrorHandler(DefaultPathTypeParameterErrorHandler).
|
// Register it with Application.Macros().SetErrorHandler(DefaultPathTypeParameterErrorHandler).
|
||||||
func DefaultPathTypeParameterErrorHandler(ctx *context.Context, paramIndex int, err error) {
|
var DefaultPathTypeParameterErrorHandler handler.ParamErrorHandler = func(ctx *context.Context, paramIndex int, err error) {
|
||||||
param := ctx.Params().GetEntryAt(paramIndex) // key, value fields.
|
param := ctx.Params().GetEntryAt(paramIndex) // key, value fields.
|
||||||
InvalidArgument.DataWithDetails(ctx, "invalid path parameter", err.Error(), param)
|
InvalidArgument.DataWithDetails(ctx, "invalid path parameter", err.Error(), param)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user