ChangeFailedEvent class

The StateManager object dispatches a ChangeFailedEvent object when an attempt to set the state results in an error.

The event includes a reason and reasonCode property, which define the reason for which the attempt to change data failed. The failedValues property of the ChangeFailedEvent object is an array of key-value pairs of state data you tried to set.

For an example, see StateManager.

ChangeFailedEvent properties

The ChangeFailedEvent object has the following properties:

failedValues (Array) — an array of key-value pairs of state data you tried to set.

reason (String) — the reason for which the attempt to change data failed

reasonCode (Number) — A numeric code corresponding to the reason for which the attempt to change data failed. The reasonCode and reason properties can be set to the following values:

reasonCode

reason

Details

401

"Permission denied -- trying to edit a key that is only editable by moderators or publishers."

When a key name begins with moderator_ or publisher_, the property can only be set (or changed) by a client that has a token that has been assigned the role of moderator or publisher.

402

"Invalid key -- either key length limit exceeded or key contains invalid values."

Keys must be 100 characters or less, and they cannot contain spaces.

403

"Invalid value -- either value length limit exceeded or the value had invalid values or was not a string."

Each value must be 1000 characters or less. Values must be String objects. Setting a value to null deletes the key.

405

"Maximum number of keys exceeded."

You are limited to setting up to 20 keys.

450

"Cannot set set state for an archive."

You can only call set() in a StateManager object for a session, not in one for an archive (obtained by calling the getStateManager() method of an Archive object).

500

"Unknown error -- failed to set the state for unknown reason."

target (Object) — The StateManager object that dispatched the event.

type (String) — The type of event. The type property is set to "changeFailed".

See

Archive.getStateManager()

Session.getStateManager()

StateManager

IRC Live Chat

Have a quick question? Chat with TokBox Support on IRC. Join chat