Page MenuHomePhabricator

[Cashtab] Improve error handling in validation.js
ClosedPublic

Authored by emack on Jan 13 2022, 10:57.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Commits
rABC801711555788: [Cashtab] Improve error handling in validation.js
Summary

Added error handling for null and empty string inputs for the isValidEtokenAddress and isValidXecAddress functions within validation.js

Test Plan

npm test
ensure validation.test.js test suites pass successfully

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emack requested review of this revision.Jan 13 2022, 10:57

Hey, looks like a good diff -- was there a specific code issue that this was required for?

If not, nbd since it's still an improvement -- but please create a task to associate with this diff.

This revision now requires changes to proceed.Jan 19 2022, 20:20

This diff came about based on one of your comments in D10758 in that there's no need for null checks in cashmethod's new convertEtokenToEcashAddr function since this is already taken care of in validation's isValidEtokenAddress. However when I looked at isValidEtokenAddress there weren't any null checks, which leads to null pointer exceptions when a null input unit test is added for the convertEtokenToEcashAddr function.

Current plan is to retain the null check in D10758 as coded, and then when this lands I'll back it out.

Hey, looks like a good diff -- was there a specific code issue that this was required for?

If not, nbd since it's still an improvement -- but please create a task to associate with this diff.

This revision is now accepted and ready to land.Jan 24 2022, 20:34