error handling, raw pattern, pattern from file