Skip to content

XYZ-451: Adds for arbitrary reason_code in general failure - #10

Open
nanodirijabl wants to merge 6 commits into
masterfrom
XYZ-451/ft/limit-overflow-failure-details
Open

XYZ-451: Adds for arbitrary reason_code in general failure#10
nanodirijabl wants to merge 6 commits into
masterfrom
XYZ-451/ft/limit-overflow-failure-details

Conversation

@nanodirijabl

Copy link
Copy Markdown
Contributor

No description provided.

@nanodirijabl
nanodirijabl requested review from a team and ndiezel0 September 1, 2026 11:23
Comment thread rebar.config
% Common project dependencies.
{deps, [
{damsel, {git, "https://github.com/valitydev/damsel.git", {branch, "master"}}}
{damsel, {git, "https://github.com/valitydev/damsel.git", {branch, "XYZ-451/ft/limit-overflow-failure-details"}}}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зависит от valitydev/damsel#221

sub = #domain_SubFailure{
code = <<"limit_overflow">>,
sub = #domain_SubFailure{
code = <<"limit-that-overflowed">>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это строка и так никогда атомом стать не сможет, давай какой-то существующий атом в отдельный тест.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавил тесткейс с этим случаем. Там трансляция из динамической в статическую происходит по кодпасу дающему {unknown_error, <<"...">>}, что сохраняет старое поведение, но так же остаётся прежнее поведение, что при обратной трансляции из статической ошибки в динамическую превращает в ту же самую динамическую ошибку.

Comment thread src/payproc_errors.erl Outdated
Comment on lines +84 to +88
%% NOTE If were unable to verify code is an existing atom (expected to
%% be defined by compiling damsel protocol), then we consider code an
%% arbitrary reason code from general failure struct.
{unknown_error, ArbitraryCode} when Type =:= 'GeneralFailure' ->
#payproc_error_GeneralFailure{reason_code = ArbitraryCode};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если по какому-то стечению обстаятельств у нас ЛимитID будет выглядеть как атом то мы сюда не провалимся (например если его назовут daily к примеру).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, остаётся старое поведение. Тесткейс добавил. В итоге обслуживание reason_code получается совместимым с существующим поведением для неизвестного кода статической ошибки с таплом {unknown_error, <<"...">>}, но позволяет явно указывать произвольный код при формировании всей статической ошибки с использованием этой либы.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants