Skip to main content

@rbxts/expect > ExpectMessageBuilder > failWithReason

ExpectMessageBuilder.failWithReason() method

Returns a failure with the reason attached.

Signature:

failWithReason(reason: string): Result<ExpectMessageBuilder, ExpectMessageBuilder>;

Parameters

Parameter

Type

Description

reason

string

The reason to populate the message with.

Returns:

Result<ExpectMessageBuilder, ExpectMessageBuilder>

Example

return message.failWithReason("but it was not");

// is the same as:
return message.reason("but it was not").fail();