You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a developer I want to have an easier way to assert truthy-ness of values so that I'm more productive in general and less likely to omit/forget crucial validation of method input parameters for example.
There's a lot of "manual" validation in the code as of right now and it would be nice to have something instead that is similar to Guava's Preconditions class just for Typescript so that we can replace these
Create a class called Checks and another one called CodedError
Checks can do general assertions for truthy-ness and throw CodedError instances which are extended from the standard Error but add a code property which can make it easy to detect and equality compare two CodedError classes even if their message property varies because it has something in it that is a variable (like an ID of a transaction block or whatever else that's not static strings)
Both of these classes must work in the browser and have test coverage.
Utilities for easier one-liners that can verify arguments or
execution state in a much more concise way compared to
if conditions throwing manually. Makes the code less verbose
and requires less typing as well.
Also: added a bools utlity class for checking strict boolean
typing of a value and a new string utility method as well.
Fixeshyperledger-cacti#266
Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
Utilities for easier one-liners that can verify arguments or
execution state in a much more concise way compared to
if conditions throwing manually. Makes the code less verbose
and requires less typing as well.
Also: added a bools utlity class for checking strict boolean
typing of a value and a new string utility method as well.
Fixes#266
Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
Description
As a developer I want to have an easier way to assert truthy-ness of values so that I'm more productive in general and less likely to omit/forget crucial validation of method input parameters for example.
There's a lot of "manual" validation in the code as of right now and it would be nice to have something instead that is similar to Guava's
Preconditions
class just for Typescript so that we can replace thesewith the much more concise version like this:
Acceptance Criteria
Checks
and another one calledCodedError
CodedError
instances which are extended from the standardError
but add acode
property which can make it easy to detect and equality compare twoCodedError
classes even if theirmessage
property varies because it has something in it that is a variable (like an ID of a transaction block or whatever else that's not static strings)cc: @sfuji822 @takeutak @jonathan-m-hamilton
The text was updated successfully, but these errors were encountered: