Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mtxclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
mtxclient
Commits
b3740e26
Verified
Commit
b3740e26
authored
2 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Support retry timeouts
parent
8dd9214f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/mtx/errors.hpp
+5
-0
5 additions, 0 deletions
include/mtx/errors.hpp
lib/structs/errors.cpp
+4
-0
4 additions, 0 deletions
lib/structs/errors.cpp
with
9 additions
and
0 deletions
include/mtx/errors.hpp
+
5
−
0
View file @
b3740e26
...
...
@@ -3,6 +3,8 @@
/// @file
/// @brief The error struct returned by the Matrix API.
#include
<chrono>
#include
"lightweight_error.hpp"
#include
"user_interactive.hpp"
...
...
@@ -19,6 +21,9 @@ struct Error
//! Auth flows in case of 401
user_interactive
::
Unauthorized
unauthorized
;
//! Retry delay in case of 429
std
::
chrono
::
duration
<
std
::
uint64_t
,
std
::
milli
>
retry_after
;
friend
void
from_json
(
const
nlohmann
::
json
&
obj
,
Error
&
error
);
};
}
...
...
This diff is collapsed.
Click to expand it.
lib/structs/errors.cpp
+
4
−
0
View file @
b3740e26
...
...
@@ -111,6 +111,10 @@ from_json(const nlohmann::json &obj, Error &error)
if
(
obj
.
contains
(
"flows"
))
error
.
unauthorized
=
obj
.
get
<
user_interactive
::
Unauthorized
>
();
if
(
obj
.
contains
(
"retry_after_ms"
))
error
.
retry_after
=
std
::
chrono
::
milliseconds
(
obj
.
value
(
"retry_after_ms"
,
std
::
uint64_t
{
0
}));
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment