The `middleware` should log error message

Resolved #23