updates go() usages to pass a function that returns a promise (instead of just the promise)
fixes the type errors in the goEncodeEvmScript() function when calling the fail() function:
Type 'GoResultError<Error>' is not assignable to type 'GoResultError<EncodedEvmScriptError>'.
increases the Cypress default command timeout from 10s to 15s (had 3 test failures in a row due to the timeout being hit)
How did you action this task?
W.r.t. the type errors in the goEncodeEvmScript(), instead of passing the EncodedEvmScriptError type argument to the fail() function for each call, I let the type be the broader Error, and used instanceof when using the error when validating the proposal form:
if (!goRes.success) {
+ if (goRes.error instanceof EncodedEvmScriptError) {
const { field, value } = goRes.error;
newErrors[field] = value;
+ } else {
+ // We should always get an EncodedEvmScriptError, but we give the user a message just in case it is not
+ newErrors.generic = 'Failed to encode';
+ }
foundErrors = true;
}
Resolves #395
What does this change?
go()
usages to pass a function that returns a promise (instead of just the promise)goEncodeEvmScript()
function when calling thefail()
function:How did you action this task?
W.r.t. the type errors in the
goEncodeEvmScript()
, instead of passing theEncodedEvmScriptError
type argument to thefail()
function for each call, I let the type be the broaderError
, and usedinstanceof
when using the error when validating the proposal form: