Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Spurious error messages from API

1490436593
Lucian
Pro
API Scripter
This may seem like a minor issue, but it's actually really quite frustrating for developers trying to support API scripts, and I'm hoping it should be a really easy fix. At the moment, if you create a character object using createObj, and you just give it a name, you get a pair of error messages: "ERROR: You cannot set the imgsrc or avatar of an object unless you use an image that is in your Roll20 Library. See the API documentation for more info." "ERROR: You cannot set the imgsrc or avatar of an object unless you use an image that is in your Roll20 Library. See the API documentation for more info." It seems like you should only get this error when you actually attempt to set an avatar, not when you leave the value blank. Similarly, when you request an attribute that does not (yet) exist using getAttrByName(charId, name); you get an ERROR message in the log saying that it doesn't exist. This seems like a mistake given that this is a very normal way to check for the presence of a value for an attribute. I've put quite a lot of effort into building a logging framework for my script with configurable levels. On its normal settings it's quite parsimonious with its output, and real errors are quite easy for users to pick out in the log. I'm careful to ensure that spurious errors are suppressed and I'm trying to train the less technical users of the script to pay attention to the API console output and include it when reporting errors. The presence of these spurious Roll20 errors generates a lot of confusion for these users and makes it harder to get them to pay attention to real ERRORS!
+1
1491424525
Gid
Roll20 Team
Lucian, can you share a code snippet for this so we can reproduce it on our end, please?
1491604094
Lucian
Pro
API Scripter
Well, the avatar thing is pretty simple. If you do: createObj('character', {name: 'Tester'}); anywhere in a script it will happen. As for the attribute one, well: getAttrByName(myCharId, 'doesntExist'); will trigger it. It's my contention that it is not necessarily an error to request an attribute that doesn't exist and has no default - that's a perfectly valid thing to do to check for the presence of an optional field. It should be up to the script to determine if the absence of an attribute is an error.