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)
Sun, Dec 15, 4:27 AM
Unknown Object (File)
Sun, Dec 15, 4:04 AM
Unknown Object (File)
Sat, Dec 14, 2:25 PM
Unknown Object (File)
Mon, Dec 2, 8:21 AM
Unknown Object (File)
Wed, Nov 27, 9:31 AM
Unknown Object (File)
Nov 8 2024, 11:34 AM
Unknown Object (File)
Nov 6 2024, 8:22 PM
Unknown Object (File)
Oct 18 2024, 1:51 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
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