Example #1
0
func v2mError(err error) *mojom.Error {
	return &mojom.Error{
		Id:         string(verror.ErrorID(err)),
		ActionCode: uint32(verror.Action(err)),
		Msg:        err.Error(),
	}
}
Example #2
0
func ThrowSwiftError(ctx *context.T, err error, swiftVErrorStructPtr unsafe.Pointer) {
	id := verror.ErrorID(err)
	actionCode := verror.Action(err)
	vErr := verror.Convert(verror.IDAction{id, actionCode}, ctx, err)
	pcs := verror.Stack(vErr)
	stacktrace := pcs.String()
	msg := vErr.Error()

	var swiftErrorPtr *C.SwiftVError = (*C.SwiftVError)(swiftVErrorStructPtr)
	(*swiftErrorPtr).identity = C.CString((string)(id))
	(*swiftErrorPtr).actionCode = C._GoUint32(actionCode)
	(*swiftErrorPtr).msg = C.CString(msg)
	(*swiftErrorPtr).stacktrace = C.CString(stacktrace)
}