fix(t233): add redacted ERP diagnostics
This commit is contained in:
@@ -25,3 +25,21 @@ func TestMapFreightPreflightErrorUsesStablePublicErrors(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMapFreightCreateErrorPreservesPreflightErrors(t *testing.T) {
|
||||
for _, testCase := range []struct {
|
||||
err error
|
||||
want error
|
||||
}{
|
||||
{domain.ErrFreightSourceOCRInvalid, ErrOCRServiceInvalid},
|
||||
{domain.ErrFreightSourceNotConfigured, ErrERPNotConfigured},
|
||||
{domain.ErrFreightSourceLoginRejected, ErrERPLoginRejected},
|
||||
{domain.ErrFreightSourceProtocol, ErrERPProtocol},
|
||||
{domain.ErrFreightSourceUnavailable, ErrERPUnavailable},
|
||||
} {
|
||||
actual := mapFreightCreateError(testCase.err)
|
||||
if !errors.Is(actual, testCase.want) || !errors.Is(actual, testCase.err) {
|
||||
t.Fatalf("mapFreightCreateError(%v) = %v", testCase.err, actual)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,14 +379,18 @@ func (adapter *UsecaseAdapter) CreateFreightSync(
|
||||
)
|
||||
}
|
||||
if err != nil {
|
||||
if errors.Is(err, domain.ErrFreightSourceOCRInvalid) {
|
||||
return FreightSync{}, &adapterError{public: ErrOCRServiceInvalid, cause: err}
|
||||
}
|
||||
return FreightSync{}, mapUsecaseError(err)
|
||||
return FreightSync{}, mapFreightCreateError(err)
|
||||
}
|
||||
return freightSyncFrom(result.Run), nil
|
||||
}
|
||||
|
||||
func mapFreightCreateError(err error) error {
|
||||
if mapped := mapFreightPreflightError(err); mapped != nil {
|
||||
return mapped
|
||||
}
|
||||
return mapUsecaseError(err)
|
||||
}
|
||||
|
||||
func (adapter *UsecaseAdapter) GetFreightWatermark(
|
||||
ctx context.Context,
|
||||
) (*FreightWatermark, error) {
|
||||
|
||||
Reference in New Issue
Block a user