SteemJ V0.4.0 Feature Preview – Improved error handling by validation

in #steemdev7 years ago

SteemJ v0.4.0 will help you to understand why specific actions failed.


SteemJV2Logo

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 ://steemit.com/chart/@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.

https://github.com/marvin-we/steem-java-api-wrapper

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.


If you want to stay up to date or just like the stuff I am doing it would be great if you could press the button below =).

Follow meFollow @dez1337
follow mefollow dez1337


Thanks for reading and best regards,
@dez1337

Sort:  

Quite informative, thanks!

Take your time friend..we wait a fantastic platform.

Wow! It is very amazing!

Is there any way to tell steem that a person with more steem power is misusing his power because this happened with me 😢😢 which decreased my reputation and earning too

As the posts of those bots stated: They identified that your posts contain a lot of copied stuff. - I do not know the algorithm, but I guess you can get rid of them if you do not copy a huge amount of your posts and by providing a link to the sources.

Thanks for the info!!!

Follow me and I'll follow you back!

Coin Marketplace

STEEM 0.26
TRX 0.11
JST 0.033
BTC 64678.67
ETH 3086.68
USDT 1.00
SBD 3.87