question

glen avatar image
glen asked

Add Friend in CloudScript Issues

When attempting to add a friend in Cloud Script the request will fail with a CloudScriptAPIRequestError for circumstances where the expectation is to receive a different error code.

So far I've tested adding a friend who is already friends and adding a friend who doesn't exist. For this I'm using FriendTitleDisplayName. Both times I receive CloudScriptAPIRequestError and the handler function in CloudScript stops executing immediately returning the error. I expected that I'd receive errors which indicate UsersAlreadyFriends or AccountNotFound and that the handler function wouldn't break.

When using the same handler function to add a friend who does exist and isn't currently friends with the player there are no errors and the friend addition appears to work.

CloudScriptFriends
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Joshua Strunk avatar image
Joshua Strunk answered

There is certainly a discussion to be had about how CloudScript handles server api errors but as of right now the way you handle this is by using Try Catch statements.

Relevant other post.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

glen avatar image glen commented ·

Ok, thanks. I'll use that.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.