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)
Sat, Sep 28, 9:59 AM
Unknown Object (File)
Wed, Sep 11, 5:31 AM
Unknown Object (File)
Tue, Sep 10, 3:49 PM
Unknown Object (File)
Sun, Sep 8, 7:04 PM
Unknown Object (File)
Sep 3 2024, 11:42 PM
Unknown Object (File)
Aug 26 2024, 7:56 AM
Unknown Object (File)
Aug 18 2024, 6:53 AM
Unknown Object (File)
Aug 9 2024, 7:58 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