SteemJ v0.4.0 will help you to understand why specific actions failed.
SteemJ V0.4.0 Feature Preview – MarketHistoryAPI
Hello Steemians!
For those of you who are waiting for the release: I am sorry, but there are still a lot of changes to make. But to keep you informed, I use this post to introduce a new improvement that will come with SteemJ v0.4.0: Offline validation of fields and operations.
It is a pretty common problem for new developers is to understand how specific calls and operations work and why a specific operation failed. While the first point, the understanding, can be improved by JavaDoc, the second point is quite painful. Error messages returned by the Steem Node are not always 100% clear to a user and until now, SteemJ only returned those messages.
With SteemJ v0.4.0 this will be improved a lot as SteemJ can now validate all actions before sending them to the Steem Node. In case of a problem, a meaningful error message will be returned.
Examples
As a first example, lets have a look at Issue #72 at GitHub. In this case, the user wanted to receive the active votes for an article and used the “getActiveVote” method for this. After sending the API-Request, the following reply from the Steem Node was returned:
{"id":9,"error":{"code":1,"message":"13 N5boost16exception_detail10clone_implINS0_19error_info_injectorISt12out_of_rangeEEEE: unknown key\nunknown key: \n {"author":"discernente","permlink":"https :@discernente/bitscreener-a-good-cryptocurrencies-free-real-time-charts-screener","what":"unknown key"}\n th_a database.cpp:385 get_comment\n\n {"call.method":"call","call.params":["database_api","get_active_votes",["discernente","https://steemit.co"[truncated 1007 chars
Do you know what went wrong here? Something is out of range? And a key is unknown? ..
After having a closer look at the returned retult, you can see that the user used the whole URL to a post here on Steemit instead of only using the permlink.
With SteemJ v0.4.0, a “InvalidParameterException” will be thrown that provides the following message:
"The provided permlink contains invalid characters. Only 'a-z', '0-9' and '-' are allowed. If copied from steemit.com, the permlink is only the part of the URL after the last '/'. “
I hope that you also think that the new response is a way clearer.
The same technique is used for Operations. Have you ever wondered why your vote operation was not successful? If, e.g., your voting weight was out of range, SteemJ v0.4.0 will now tell you about it:
"The weight can't be higher than 10000 or lower than -10000 which is equivalent to 100% and -100%."
What do you think about this new Feature?
General information
What is SteemJ?
SteemJ is a project that allows you to communicate with a Steem node using Java. So far, the project supports most of the API calls and is also able to broadcast most of the common operation types. Further information can be found on GitHub.
How to add it to your project?
SteemJ binaries are pushed into the maven central repository and can be integrated with a bunch of build management tools like Maven. The Wiki provides a lot of examples for the most common build tools. If you do not use a build management tool you can download the binaries as described here.
Contribute
The project became quite big and there is still a lot to do. If you want to support the project simply clone the git repository and submit a pull request. I would really appreciate it =).
git clone https://github.com/marvin-we/steem-java-api-wrapper.git
Get in touch!
Most of my projects are pretty time consuming and I always try to provide some useful stuff to the community. What keeps me going for that is your feedback and your support. For that reason I would love to get some Feedback from you <3. Just contact me here on Steemit or ping me on GitHub.
Follow me | Follow @dez1337 |
---|---|
Thanks for reading and best regards,
@dez1337