TD-50: Change woody.error-reason missing message to be more readable (#1)

This commit is contained in:
Alexey S 2022-01-21 15:10:58 +03:00 committed by GitHub
parent 6f818c57e3
commit 0c2e16dfc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 258 additions and 142 deletions

11
.github/codecov.yml vendored Normal file
View File

@ -0,0 +1,11 @@
coverage:
status:
project:
default:
# Allow total coverage to drop by at most 2%
target: auto
threshold: 2%
patch:
default:
# Force any given PR to be at least 70% covered
target: 70%

155
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,155 @@
name: Erlang Library CI
on:
push:
branches: [ master ]
pull_request:
branches: [ '**' ]
env:
OTP_VERSION: 24.2
REBAR_VERSION: 3.18
THRIFT_VERSION: 0.14.2.1
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup BEAM
uses: erlef/setup-beam@v1.10
with:
otp-version: ${{ env.OTP_VERSION }}
rebar3-version: ${{ env.REBAR_VERSION }}
- name: Cache _build
uses: actions/cache@v2
with:
path: _build/*/lib
key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build-${{ hashFiles('rebar.lock') }}
restore-keys: |
${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build-
- name: Compile
run: rebar3 compile
check:
name: Check
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup BEAM
uses: erlef/setup-beam@v1.10
with:
otp-version: ${{ env.OTP_VERSION }}
rebar3-version: ${{ env.REBAR_VERSION }}
- name: Cache _build
uses: actions/cache@v2
with:
path: _build/*/lib
key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build-${{ hashFiles('rebar.lock') }}
restore-keys: |
${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build-
- name: Check formatting
run: rebar3 fmt -c
- name: Run linting
run: rebar3 lint
- name: Run xref
run: rebar3 xref
dialyze:
name: Dialyze
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Thrift compiler
uses: valitydev/action-setup-thrift@v0.0.5
with:
thrift-version: ${{ env.THRIFT_VERSION }}
- name: Setup BEAM
uses: erlef/setup-beam@v1.10
with:
otp-version: ${{ env.OTP_VERSION }}
rebar3-version: ${{ env.REBAR_VERSION }}
- name: Cache _build
uses: actions/cache@v2
with:
path: _build/*/lib
key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build-${{ hashFiles('rebar.lock') }}
restore-keys: |
${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build-
- name: Cache PLTs
uses: actions/cache@v2
with:
path: _build/test/rebar3_*_plt
key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-plt-${{ hashFiles('rebar.lock') }}
restore-keys: |
${{ runner.os }}-otp-${{ env.OTP_VERSION }}-plt-
- name: Run dialyzer
run: rebar3 as test dialyzer
test:
name: Test
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Thrift compiler
uses: valitydev/action-setup-thrift@v0.0.5
with:
thrift-version: ${{ env.THRIFT_VERSION }}
- name: Setup BEAM
uses: erlef/setup-beam@v1.10
with:
otp-version: ${{ env.OTP_VERSION }}
rebar3-version: ${{ env.REBAR_VERSION }}
- name: Cache _build
uses: actions/cache@v2
with:
path: _build/*/lib
key: ${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build-${{ hashFiles('rebar.lock') }}
restore-keys: |
${{ runner.os }}-otp-${{ env.OTP_VERSION }}-build-
- name: Run EUnit
run: rebar3 eunit --cover
- name: Run CT
id: run-common-test
run: rebar3 ct --cover
- name: Store CT Logs
if: ${{ failure() && steps.run-common-test.outcome == 'failure' }}
uses: actions/upload-artifact@v2
with:
name: ct-logs
path: _build/test/logs
- name: Generate coverage reports
run: rebar3 covertool generate
- name: Upload coverage reports
uses: codecov/codecov-action@v2
with:
files: _build/test/covertool/*.covertool.xml

4
.gitmodules vendored
View File

@ -1,4 +0,0 @@
[submodule "build_utils"]
path = build_utils
url = git@github.com:rbkmoney/build_utils.git
branch = master

42
Jenkinsfile vendored
View File

@ -1,42 +0,0 @@
#!groovy
// -*- mode: groovy -*-
//
// Copyright 2017 RBKmoney
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
def finalHook = {
runStage('store CT logs') {
archive '_build/test/logs/'
}
}
build('woody_erlang', 'docker-host', finalHook) {
checkoutRepo()
loadBuildUtils()
def pipeErlangLib
runStage('load pipeline') {
env.JENKINS_LIB = "build_utils/jenkins_lib"
env.SH_TOOLS = "build_utils/sh"
pipeErlangLib = load("${env.JENKINS_LIB}/pipeErlangLib.groovy")
}
// NOTE: Parallel pipeline almost always fails because of
// rebar3's design (it uses link for libraries, so
// parallel runs with different profiles brake each other)
// To prevent this use sequential pipleine here
pipeErlangLib.runPipe(false, false, 'test')
}

View File

@ -1,43 +1,19 @@
REBAR := $(shell which rebar3 2>/dev/null || which ./rebar3) REBAR := $(shell which rebar3 2>/dev/null || which ./rebar3)
SUBMODULES = build_utils
SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES))
UTILS_PATH := build_utils .PHONY: compile test xref lint check_format format clean distclean dialyze cover bench
# ToDo: remove unused TEMPLATES_PATH here, when the bug
# with handling of the varriable in build_utils is fixed
TEMPLATES_PATH := .
SERVICE_NAME := woody
BUILD_IMAGE_NAME := build-erlang compile:
BUILD_IMAGE_TAG := c60896ef07d41e7ae2e5f9b6ce845a60ad79acc7
CALL_W_CONTAINER := all submodules compile xref lint test bench dialyze clean distclean \
check_format format
.PHONY: $(CALL_W_CONTAINER)
all: compile
-include $(UTILS_PATH)/make_lib/utils_container.mk
$(SUBTARGETS): %/.git: %
git submodule update --init $<
touch $@
submodules: $(SUBTARGETS)
compile: submodules
$(REBAR) compile $(REBAR) compile
test: submodules test:
$(REBAR) eunit $(REBAR) eunit
$(REBAR) ct $(REBAR) ct
xref: submodules xref:
$(REBAR) xref $(REBAR) xref
lint: compile lint:
elvis rock $(REBAR) lint
check_format: check_format:
$(REBAR) fmt -c $(REBAR) fmt -c
@ -57,6 +33,10 @@ distclean:
dialyze: dialyze:
$(REBAR) as test dialyzer $(REBAR) as test dialyzer
cover:
$(REBAR) cover
$(REBAR) covertool generate
bench: bench:
$(REBAR) as test bench -m bench_woody_event_handler -n 1000 $(REBAR) as test bench -m bench_woody_event_handler -n 1000
$(REBAR) as test bench -m bench_woody_formatter -n 10 $(REBAR) as test bench -m bench_woody_formatter -n 10

View File

@ -1,7 +1,7 @@
Woody [![Build Status](http://ci.rbkmoney.com/buildStatus/icon?job=rbkmoney_private/woody_erlang/master)](http://ci.rbkmoney.com/job/rbkmoney_private/view/Erlang/job/woody_erlang/job/master/) Woody
====== ======
Erlang реализация [Библиотеки RPC вызовов для общения между микросервисами](http://coredocs.rbkmoney.com/design/ms/platform/rpc-lib/) Erlang реализация [Библиотеки RPC вызовов для общения между микросервисами](#coredocs/design/ms/platform/rpc-lib/)
версия требований: __ac4d40cc22d649d03369fcd52fb1230e51cdf52e__ версия требований: __ac4d40cc22d649d03369fcd52fb1230e51cdf52e__
@ -58,7 +58,7 @@ Erlang реализация [Библиотеки RPC вызовов для об
В случае вызова _thrift_ `oneway` функции (_thrift_ реализация _cast_) `woody_client:call/3` вернет `{ok, ok}`. В случае вызова _thrift_ `oneway` функции (_thrift_ реализация _cast_) `woody_client:call/3` вернет `{ok, ok}`.
Если сервер бросает `Exception`, описанный в _.thrift_ файле сервиса (т.е. _Бизнес ошибку_ в [терминологии](http://coredocs.rbkmoney.com/design/ms/platform/overview/#_7) макросервис платформы), `woody_client:call/3` вернет это исключение в виде: `{exception, Exception}`. Если сервер бросает `Exception`, описанный в _.thrift_ файле сервиса (т.е. _Бизнес ошибку_ в [терминологии](#coredocs/design/ms/platform/overview/#_7) макросервис платформы), `woody_client:call/3` вернет это исключение в виде: `{exception, Exception}`.
В случае получения _Системной_ ошибки клиент выбрасывает _erlang:error_ типа `{woody_error, woody_error:system_error()}`. В случае получения _Системной_ ошибки клиент выбрасывает _erlang:error_ типа `{woody_error, woody_error:system_error()}`.
@ -74,7 +74,7 @@ Erlang реализация [Библиотеки RPC вызовов для об
18> {ok, Result2} = woody_client:call(Request, Opts1, Context2). 18> {ok, Result2} = woody_client:call(Request, Opts1, Context2).
``` ```
`Context` позволяет аннотировать RPC запросы дополнительными мета данными в виде _key-value_. `Context` передается только в запросах и изменение мета данных возможно только в режиме _append-only_ (т.е. на попытку переопределить уже существующую запись в `context meta`, библиотека вернет ошибку). Поскольку на транспортном уровне контекст передается в виде custom HTTP заголовков, синтаксис метаданных _key-value_ должен следовать ограничениям [RFC7230 ](https://tools.ietf.org/html/rfc7230#section-3.2.6). Размер ключа записи метаданных не должен превышать _53 байта_ (см. остальные требования к метаданным в [описании библиотеки](http://coredocs.rbkmoney.com/design/ms/platform/rpc-lib/#rpc_2)). `Context` позволяет аннотировать RPC запросы дополнительными мета данными в виде _key-value_. `Context` передается только в запросах и изменение мета данных возможно только в режиме _append-only_ (т.е. на попытку переопределить уже существующую запись в `context meta`, библиотека вернет ошибку). Поскольку на транспортном уровне контекст передается в виде custom HTTP заголовков, синтаксис метаданных _key-value_ должен следовать ограничениям [RFC7230 ](https://tools.ietf.org/html/rfc7230#section-3.2.6). Размер ключа записи метаданных не должен превышать _53 байта_ (см. остальные требования к метаданным в [описании библиотеки](#coredocs/design/ms/platform/rpc-lib/#rpc_2)).
```erlang ```erlang
19> Meta1 = #{<<"client1-name">> => <<"Vasya">>}. 19> Meta1 = #{<<"client1-name">> => <<"Vasya">>}.
@ -87,7 +87,7 @@ Erlang реализация [Библиотеки RPC вызовов для об
26> FullMeta = woody_context:get_meta(Context4). 26> FullMeta = woody_context:get_meta(Context4).
``` ```
`Context` также позволяет задать [deadline](http://coredocs.rbkmoney.com/design/ms/platform/rpc-lib/#deadline) на исполнение запроса. Значение _deadline_ вложенных запросов можно менять произвольным образом. Также таймауты на запрос, [вычисляемые по deadline](src/woody_client_thrift_http_transport.erl), можно явно переопределить из приложения через _transport_opts_ в `woody_client:options()`. Модуль [woody_deadline](src/woody_deadline.erl) содержит API для работы с deadline. `Context` также позволяет задать [deadline](#coredocs/design/ms/platform/rpc-lib/#deadline) на исполнение запроса. Значение _deadline_ вложенных запросов можно менять произвольным образом. Также таймауты на запрос, [вычисляемые по deadline](src/woody_client_thrift_http_transport.erl), можно явно переопределить из приложения через _transport_opts_ в `woody_client:options()`. Модуль [woody_deadline](src/woody_deadline.erl) содержит API для работы с deadline.
```erlang ```erlang
27> Deadline = {{{2017, 12, 31}, {23, 59, 59}}, 350}. 27> Deadline = {{{2017, 12, 31}, {23, 59, 59}}, 350}.

@ -1 +0,0 @@
Subproject commit e1318727d4d0c3e48f5122bf3197158b6695f50e

View File

@ -2,29 +2,27 @@
{elvis, [ {elvis, [
{config, [ {config, [
#{ #{
dirs => ["src", "test"], dirs => ["src", "include", "test"],
filter => "*.erl", filter => "*.erl",
ruleset => erl_files,
rules => [ rules => [
{elvis_style, line_length, #{limit => 120, skip_comments => false}}, % common conventions
{elvis_style, no_tabs}, {elvis_text_style, line_length, #{limit => 120}},
{elvis_style, no_trailing_whitespace},
{elvis_style, operator_spaces, #{rules => [{right, ","}, {right, "++"}, {left, "++"}]}},
{elvis_style, nesting_level, #{level => 3}}, {elvis_style, nesting_level, #{level => 3}},
{elvis_style, god_modules, #{limit => 25, ignore => [woody_tests_SUITE]}}, {elvis_style, no_if_expression, disable},
{elvis_style, no_if_expression}, {elvis_style, state_record_and_type, disable},
% woody_erlang specific
{elvis_style, function_naming_convention, #{regex => "^([a-z][a-z0-9_]*_?)*$"}},
{elvis_style, atom_naming_convention, #{regex => "^([a-z][a-zA-Z0-9_]*_?)*$"}},
{elvis_style, macro_names, #{ignore => [woody_transport_opts_SUITE]}},
{elvis_style, macro_module_names, disable},
{elvis_style, invalid_dynamic_call, #{ {elvis_style, invalid_dynamic_call, #{
ignore => [ ignore => [
woody_client_thrift,
woody_event_formatter, woody_event_formatter,
woody_event_handler,
woody_util woody_util
] ]
}}, }},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{elvis_style, module_naming_convention, #{regex => "^[a-z]([a-z0-9]*_?)*(_SUITE)?$"}},
{elvis_style, function_naming_convention, #{regex => "^[a-z]([a-z0-9]*_?)*$"}},
{elvis_style, no_spec_with_records},
{elvis_style, dont_repeat_yourself, #{min_complexity => 17, ignore => [woody_test_thrift, woody_tests_SUITE]}},
{elvis_style, no_debug_call, #{ {elvis_style, no_debug_call, #{
ignore => [ ignore => [
woody_ssl_SUITE, woody_ssl_SUITE,
@ -33,18 +31,14 @@
woody_ct_event_h, woody_ct_event_h,
benchmark_memory_pressure benchmark_memory_pressure
] ]
}},
{elvis_style, god_modules, #{limit => 25, ignore => [woody_tests_SUITE]}},
{elvis_style, dont_repeat_yourself, #{
min_complexity => 17,
ignore => [woody_test_thrift, woody_tests_SUITE]
}} }}
] ]
}, },
#{
dirs => ["src"],
filter => "*.app.src",
rules => [
{elvis_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace}
]
},
#{ #{
dirs => ["."], dirs => ["."],
filter => "Makefile", filter => "Makefile",
@ -58,10 +52,22 @@
#{ #{
dirs => ["."], dirs => ["."],
filter => "rebar.config", filter => "rebar.config",
ruleset => rebar_config,
rules => [ rules => [
{elvis_style, line_length, #{limit => 120, skip_comments => false}}, {elvis_text_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_style, no_tabs}, {elvis_text_style, no_tabs},
{elvis_style, no_trailing_whitespace} {elvis_text_style, no_trailing_whitespace},
%% Temporarily disabled till regex pattern is available
{elvis_project, no_deps_master_rebar, disable}
]
},
#{
dirs => ["src"],
filter => "*.app.src",
rules => [
{elvis_text_style, line_length, #{limit => 120, skip_comments => false}},
{elvis_text_style, no_tabs},
{elvis_text_style, no_trailing_whitespace}
] ]
} }
]} ]}

View File

@ -22,11 +22,11 @@
{deps, [ {deps, [
{cowboy, "2.9.0"}, {cowboy, "2.9.0"},
{hackney, "1.18.0"}, {hackney, "1.18.0"},
{gproc , "0.9.0"}, {gproc, "0.9.0"},
{cache , "2.3.3"}, {cache, "2.3.3"},
{thrift, {git, "https://github.com/rbkmoney/thrift_erlang.git", {branch, "master"}}}, {thrift, {git, "https://github.com/valitydev/thrift_erlang.git", {branch, "master"}}},
{snowflake, {git, "https://github.com/rbkmoney/snowflake.git", {branch, "master"}}}, {snowflake, {git, "https://github.com/valitydev/snowflake.git", {branch, "master"}}},
{genlib, {git, "https://github.com/rbkmoney/genlib.git", {branch, "master"}}} {genlib, {git, "https://github.com/valitydev/genlib.git", {branch, "master"}}}
]}. ]}.
{xref_checks, [ {xref_checks, [
@ -70,9 +70,14 @@
{deps, [ {deps, [
{cth_readable, "1.4.9"}, {cth_readable, "1.4.9"},
{proper, "1.4.0"}, {proper, "1.4.0"},
{woody_api_hay,{git, "https://github.com/rbkmoney/woody_api_hay.git", {branch, "master"}}}, {woody_api_hay,
{damsel , {git, "https://github.com/rbkmoney/damsel.git", {ref, "8911ac3"}}}, {git, "https://github.com/valitydev/woody_api_hay.git",
{mg_proto , {git, "https://github.com/rbkmoney/machinegun_proto.git", {ref, "ebae56f"}}} {ref, "4c39134cddaa9bf6fb8db18e7030ae64f1efb3a9"}}},
{damsel,
{git, "https://github.com/valitydev/damsel.git", {ref, "3fa6f31db54b2ae781b27898ab4daf56bb36eb36"}}},
{mg_proto,
{git, "https://github.com/valitydev/machinegun-proto.git",
{ref, "ebae56fe2b3e79e4eb34afc8cb55c9012ae989f8"}}}
]}, ]},
{dialyzer, [ {dialyzer, [
{plt_extra_apps, [how_are_you, eunit, proper, common_test, cth_readable]} {plt_extra_apps, [how_are_you, eunit, proper, common_test, cth_readable]}
@ -81,14 +86,25 @@
]}. ]}.
{plugins, [ {plugins, [
{rebar3_thrift_compiler, {git, "https://github.com/rbkmoney/rebar3_thrift_compiler.git", {branch, "master"}}}, {rebar3_thrift_compiler, {git, "https://github.com/valitydev/rebar3_thrift_compiler.git", {tag, "0.3.1"}}},
{erlfmt, "0.14.1"} {erlfmt, "1.0.0"},
{rebar3_lint, "1.0.1"},
{covertool, "2.0.4"}
]}. ]}.
{erlfmt, [ {erlfmt, [
{print_width, 120}, {print_width, 120},
{files, [ {files, [
"{src,include,test}/*.{hrl,erl}", "{src,include}/*.{hrl,erl}",
"test/*/*.{hrl,erl}" "test/*.{hrl,erl}",
"rebar.config",
"elvis.config"
]}
]}.
{covertool, [
{coverdata_files, [
"eunit.coverdata",
"ct.coverdata"
]} ]}
]}. ]}.

View File

@ -1,5 +0,0 @@
case os:getenv("WERCKER_CACHE_DIR") of
false -> CONFIG;
[] -> CONFIG;
Dir -> lists:keystore(global_rebar_dir, 1, CONFIG, {global_rebar_dir, Dir})
end.

View File

@ -4,8 +4,8 @@
{<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.9.0">>},0}, {<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.9.0">>},0},
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},1}, {<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},1},
{<<"genlib">>, {<<"genlib">>,
{git,"https://github.com/rbkmoney/genlib.git", {git,"https://github.com/valitydev/genlib.git",
{ref,"4565a8d73f34a0b78cca32c9cd2b97d298bdadf8"}}, {ref,"82c5ff3866e3019eb347c7f1d8f1f847bed28c10"}},
0}, 0},
{<<"gproc">>,{pkg,<<"gproc">>,<<"0.9.0">>},0}, {<<"gproc">>,{pkg,<<"gproc">>,<<"0.9.0">>},0},
{<<"hackney">>,{pkg,<<"hackney">>,<<"1.18.0">>},0}, {<<"hackney">>,{pkg,<<"hackney">>,<<"1.18.0">>},0},
@ -15,12 +15,12 @@
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},1}, {<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},1},
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},1}, {<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},1},
{<<"snowflake">>, {<<"snowflake">>,
{git,"https://github.com/rbkmoney/snowflake.git", {git,"https://github.com/valitydev/snowflake.git",
{ref,"de159486ef40cec67074afe71882bdc7f7deab72"}}, {ref,"de159486ef40cec67074afe71882bdc7f7deab72"}},
0}, 0},
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.6">>},1}, {<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.6">>},1},
{<<"thrift">>, {<<"thrift">>,
{git,"https://github.com/rbkmoney/thrift_erlang.git", {git,"https://github.com/valitydev/thrift_erlang.git",
{ref,"c280ff266ae1c1906fb0dcee8320bb8d8a4a3c75"}}, {ref,"c280ff266ae1c1906fb0dcee8320bb8d8a4a3c75"}},
0}, 0},
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},1}]}. {<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},1}]}.

View File

@ -17,9 +17,6 @@
{enable_debug, false} {enable_debug, false}
]}, ]},
{modules, []}, {modules, []},
{maintainers, [
"Anton Belyaev <a.belyaev@rbkmoney.com>"
]},
{licenses, []}, {licenses, []},
{links, []} {links, []}
]}. ]}.

View File

@ -300,9 +300,11 @@ check_error_reason(Headers, Code, WoodyState) ->
-spec do_check_error_reason(header_parse_value(), woody:http_code(), woody_state:st()) -> woody_error:details(). -spec do_check_error_reason(header_parse_value(), woody:http_code(), woody_state:st()) -> woody_error:details().
do_check_error_reason(none, 200, _WoodyState) -> do_check_error_reason(none, 200, _WoodyState) ->
<<>>; <<>>;
do_check_error_reason(none, Code, WoodyState) -> do_check_error_reason(none, _Code, WoodyState) ->
_ = log_event(?EV_TRACE, WoodyState, #{event => woody_util:to_binary([?HEADER_E_REASON, " header missing"])}), _ = log_event(?EV_TRACE, WoodyState, #{event => woody_util:to_binary([?HEADER_E_REASON, " header missing"])}),
woody_util:to_binary(["got response with http code ", Code, " and without ", ?HEADER_E_REASON, " header"]); woody_util:to_binary([
"This server does not implement the woody protocol ('", ?HEADER_E_REASON, "' header missing)."
]);
do_check_error_reason(Reason, _, _) -> do_check_error_reason(Reason, _, _) ->
Reason. Reason.

View File

@ -294,9 +294,11 @@ check_error_reason(Headers, Code, WoodyState) ->
-spec do_check_error_reason(header_parse_value(), woody:http_code(), woody_state:st()) -> woody_error:details(). -spec do_check_error_reason(header_parse_value(), woody:http_code(), woody_state:st()) -> woody_error:details().
do_check_error_reason(none, 200, _WoodyState) -> do_check_error_reason(none, 200, _WoodyState) ->
<<>>; <<>>;
do_check_error_reason(none, Code, WoodyState) -> do_check_error_reason(none, _Code, WoodyState) ->
_ = log_event(?EV_TRACE, WoodyState, #{event => woody_util:to_binary([?HEADER_E_REASON, " header missing"])}), _ = log_event(?EV_TRACE, WoodyState, #{event => woody_util:to_binary([?HEADER_E_REASON, " header missing"])}),
woody_util:to_binary(["got response with http code ", Code, " and without ", ?HEADER_E_REASON, " header"]); woody_util:to_binary([
"This server does not implement the woody protocol ('", ?HEADER_E_REASON, "' header missing)."
]);
do_check_error_reason(Reason, _, _) -> do_check_error_reason(Reason, _, _) ->
Reason. Reason.

View File

@ -661,14 +661,14 @@ format_service_request_test_() ->
), ),
?_assertEqual( ?_assertEqual(
"[1012689088739803136 1012689108264288256 1012689088534282240][client] calling " "[1012689088739803136 1012689108264288256 1012689088534282240][client] calling "
"CustomerManagement:Create(params=CustomerParams{party_id='1CQdDqPROyW',shop_id='1CQdDwgt3R3'," "CustomerManagement:Create(params=CustomerParams{customer_id='1',party_id='1CQdDqPROyW',"
"contact_info=ContactInfo{email='invalid_shop'},metadata=Value{nl=Null{}}})", "shop_id='1CQdDwgt3R3',contact_info=ContactInfo{email='invalid_shop'},metadata=Value{nl=Null{}}})",
format_msg_limited( format_msg_limited(
format_event( format_event(
?EV_CALL_SERVICE, ?EV_CALL_SERVICE,
#{ #{
args => args =>
{{payproc_CustomerParams, <<"1CQdDqPROyW">>, <<"1CQdDwgt3R3">>, {{payproc_CustomerParams, <<"1">>, <<"1CQdDqPROyW">>, <<"1CQdDwgt3R3">>,
{domain_ContactInfo, undefined, <<"invalid_shop">>}, {nl, {json_Null}}}}, {domain_ContactInfo, undefined, <<"invalid_shop">>}, {nl, {json_Null}}}},
function => 'Create', function => 'Create',
metadata => #{ metadata => #{

View File

@ -760,13 +760,12 @@ call_no_headers_503_test(_) ->
call_no_headers_504_test(_) -> call_no_headers_504_test(_) ->
call_fail_w_no_headers(<<"call_no_headers_404">>, result_unknown, 504). call_fail_w_no_headers(<<"call_no_headers_404">>, result_unknown, 504).
call_fail_w_no_headers(Id, Class, Code) -> call_fail_w_no_headers(Id, Class, _Code) ->
Gun = <<"Enforcer">>, Gun = <<"Enforcer">>,
Context = make_context(Id), Context = make_context(Id),
{Url, Service} = get_service_endpoint('Weapons'), {Url, Service} = get_service_endpoint('Weapons'),
BinCode = integer_to_binary(Code),
?assertError( ?assertError(
{woody_error, {external, Class, <<"got response with http code ", BinCode:3/binary, _/binary>>}}, {woody_error, {external, Class, <<"This server does not implement the woody protocol", _/binary>>}},
woody_client:call( woody_client:call(
{Service, get_weapon, {Gun, self_to_bin()}}, {Service, get_weapon, {Gun, self_to_bin()}},
#{url => Url, event_handler => ?MODULE}, #{url => Url, event_handler => ?MODULE},