improve missing factory error

and use regex matching for assertThrows