merge wrap to middleware
add custom error