function Expectation.throw(c,F)local t,D=pcall(c.value)local C=t~=c.successCondition if F and not t then if c.successCondition then C=D:find(F,1,true)~=nil else C=D:find(F,1,true)==nil end end local U if F then U=formatMessage(c.successCondition,("\069\120\112\101\099\116\101\100 \102\117\110\099\116\105\111\110 \116\111 \116\104\114\111\119 \097\110 \101\114\114\111\114 \099\111\110\116\097\105\110\105\110\103 \037\113\044 \098\117\116 \105\116 \037\115"):format(F,D and("\116\104\114\101\119\058 \037\115"):format(D)or"\100\105\100 \110\111\116 \116\104\114\111\119\046"),("\069\120\112\101\099\116\101\100 \102\117\110\099\116\105\111\110 \116\111 \110\101\118\101\114 \116\104\114\111\119 \097\110 \101\114\114\111\114 \099\111\110\116\097\105\110\105\110\103 \037\113\044 \098\117\116 \105\116 \116\104\114\101\119\058 \037\115"):format(F,tostring(D)))else U=formatMessage(c.successCondition,"\069\120\112\101\099\116\101\100 \102\117\110\099\116\105\111\110 \116\111 \116\104\114\111\119 \097\110 \101\114\114\111\114\044 \098\117\116 \105\116 \100\105\100 \110\111\116 \116\104\114\111\119\046",("\069\120\112\101\099\116\101\100 \102\117\110\099\116\105\111\110 \116\111 \115\117\099\099\101\101\100\044 \098\117\116 \105\116 \116\104\114\101\119 \097\110 \101\114\114\111\114\058 \037\115"):format(tostring(D)))end assertLevel(C,U,3)c:_resetModifiers()return c end return Expectation

function Expectation:throw(messageSubstring)
	local ok, err = pcall(self.value)
	local result = ok ~= self.successCondition

	if messageSubstring and not ok then
		if self.successCondition then
			result = err:find(messageSubstring, 1, true) ~= nil
		else
			result = err:find(messageSubstring, 1, true) == nil
		end
	end

	local message

	if messageSubstring then
		message = formatMessage(self.successCondition,
			("Expected function to throw an error containing %q, but it %s"):format(
				messageSubstring,
				err and ("threw: %s"):format(err) or "did not throw."
			),
			("Expected function to never throw an error containing %q, but it threw: %s"):format(
				messageSubstring,
				tostring(err)
			)
		)
	else
		message = formatMessage(self.successCondition,
			"Expected function to throw an error, but it did not throw.",
			("Expected function to succeed, but it threw an error: %s"):format(
				tostring(err)
			)
		)
	end

	assertLevel(result, message, 3)
	self:_resetModifiers()

	return self
end

return Expectation
