added optional error raising