janboddez/share-on-mastodon

Uncaught (in promise) Error: The "Get URL" request failed.

Closed this issue ยท 3 comments

Guess we can't catch errors this way if promises are involved. But I'm also not sure why it'd fail. ๐Ÿ˜…

[12-Nov-2023 07:59:50 UTC] REST request: /share-on-mastodon/v1/url: {"post_id":"16484","_locale":"user"}(Header Absent)
[12-Nov-2023 07:59:50 UTC] REST result: /share-on-mastodon/v1/url: {"code":"rest_forbidden","message":"Sorry, you are not allowed to do that.","data":{"status":403}}(403) - [](User ID: 3)

Nay have to with ...

if ( empty( $post_id ) || ! is_int( $post_id ) ) {
	return false;
}

If somehow $post_id turns out to not always be an int.

Ah, I now see why. I use GET params (i.e., a query string) i.s.o. JSON ... at least in one place.