Page MenuHomePhabricator

[identity] Use DB error types from comm-lib
ClosedPublic

Authored by bartek on Dec 22 2023, 5:48 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 8, 11:34 AM
Unknown Object (File)
Wed, Nov 6, 8:22 PM
Unknown Object (File)
Fri, Oct 18, 1:51 AM
Unknown Object (File)
Fri, Oct 18, 1:51 AM
Unknown Object (File)
Fri, Oct 18, 1:51 AM
Unknown Object (File)
Fri, Oct 18, 1:50 AM
Unknown Object (File)
Fri, Oct 18, 1:50 AM
Unknown Object (File)
Thu, Oct 17, 2:39 PM
Subscribers

Details

Summary

The DBItemError and DBItemAttributeError were defined both in Identity and comm-lib, however their signatures differ slightly.
Replaced the definitions in Identity with the ones from comm-lib, made slight modifications (added From derive) to make them compatible.
This isn't perfect and is kind of messy, but will be reworked later.

Depends on D10446

Test Plan

Identity compiles, tests pass.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Dec 22 2023, 6:18 AM

The main issue here was that Identity attribute_value is of type Option<AttributeValue> while comm-lib is of enum type Value. The simplest way was to introduce From derive and use .into() where needed.

Perhaps we can do better but I didn't want this diff to grow too large (changing all usages in other services).

If I understand the error type correctly, shouldn't we use Value::String in places where we directly create Some(AttributeValue::S(...)?

This revision is now accepted and ready to land.Jan 2 2024, 4:00 AM

If I understand the error type correctly, shouldn't we use Value::String in places where we directly create Some(AttributeValue::S(...)?

Yeah, good call. Not sure why the Value enum was introduced initially, but anyway your suggestion looks better now

Apply suggestion: simplify string types