mergedWith method
- @useResult
- @mustBeOverridden
- @override
- UserException? anotherUserException
override
Returns a new UserException, by merging the current one with the given anotherUserException
.
This simply means the given anotherUserException
will be used as part of the reason of the
current one.
Note: If any of the exceptions has ifOpenDialog set to false
, the result will also
have ifOpenDialog set to false
.
Implementation
@useResult
@mustBeOverridden
@override
UserException mergedWith(UserException? anotherUserException) {
if (anotherUserException == null)
return this;
else {
UserException exception = super.mergedWith(anotherUserException);
return AdvancedUserException(
exception.message,
reason: exception.reason,
code: exception.code,
onOk: onOk,
onCancel: onCancel,
hardCause: hardCause,
props: props,
errorText: (anotherUserException.errorText?.isNotEmpty ?? false)
? anotherUserException.errorText
: errorText,
ifOpenDialog: ifOpenDialog && anotherUserException.ifOpenDialog,
);
}
}