Moved error as a anon function for set debug