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
// ErrorfInternal calls ErrInternal.Errorf with the supplied arguments.funcErrorfInternal(ctx*context.T, formatstring) error {
returnErrInternal.Errorf(ctx, format)
}
// MessageInternal calls ErrInternal.Message with the supplied arguments.funcMessageInternal(ctx*context.T, messagestring) error {
returnErrInternal.Message(ctx, message)
}
// ParamsErrInternal extracts the expected parameters from the error's ParameterList.funcParamsErrInternal(argumentErrorerror) (verrorComponentstring, verrorOperationstring, returnErrerror) {
params:=Params(argumentError)
ifparams==nil {
returnErr=fmt.Errorf("no parameters found in: %T: %v", argumentError, argumentError)
return
}
iter:=¶mListIterator{params: params, max: len(params)}
ifverrorComponent, verrorOperation, returnErr=iter.preamble(); returnErr!=nil {
return
}
return
}
The ErrorfInternal function looks like a mistake since there are no parameters beyond the format. This is because these functions are intended for encapsulating parameters within the verror implementation and for those parameters to be returned to the callee, even if that callee is remote. The confusion is that the Errorf method (ErrInternal.Errorf) performs this encapsulation, which for the vast, vast majority of cases, is never actually used. A better API would be separate parameter encapsulation from error message formatting. That is to provide two methods:
Errorf - just generates an error, with normal, in-process error encapsulation as per go's error package.
ErrorfWithParams - also encapsulates the parameters for transmission to remote processes.
The text was updated successfully, but these errors were encountered:
A vdl error definition of the form:
leads to generated code of the form:
The
ErrorfInternal
function looks like a mistake since there are no parameters beyond the format. This is because these functions are intended for encapsulating parameters within the verror implementation and for those parameters to be returned to the callee, even if that callee is remote. The confusion is that theErrorf
method (ErrInternal.Errorf
) performs this encapsulation, which for the vast, vast majority of cases, is never actually used. A better API would be separate parameter encapsulation from error message formatting. That is to provide two methods:Errorf
- just generates an error, with normal, in-process error encapsulation as per go's error package.ErrorfWithParams
- also encapsulates the parameters for transmission to remote processes.The text was updated successfully, but these errors were encountered: