Make exceptions for parsing errors thread safe