function to wrap error with function's name | make ctx always present