Custom error function for error printing with filename and line number