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)
Mon, Dec 23, 8:58 AM
Unknown Object (File)
Mon, Dec 23, 8:58 AM
Unknown Object (File)
Mon, Dec 23, 8:58 AM
Unknown Object (File)
Mon, Dec 23, 8:58 AM
Unknown Object (File)
Mon, Dec 23, 8:58 AM
Unknown Object (File)
Fri, Dec 20, 12:37 PM
Unknown Object (File)
Fri, Dec 20, 9:09 AM
Unknown Object (File)
Sun, Dec 15, 4:27 AM
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
No Lint Coverage
Unit
No Test Coverage

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