Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Common Library
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Rutherford Experiment Lab Course Online
Common Library
Commits
66e03e04
Verified
Commit
66e03e04
authored
4 years ago
by
Tobias Triffterer
Browse files
Options
Downloads
Patches
Plain Diff
Add Method to Parse Error Commands
This is a parsing method like the others, this time for error commands.
parent
a4958ec5
No related branches found
No related tags found
No related merge requests found
Pipeline
#2981
passed with stage
Stage:
in 22 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/command.cpp
+17
-0
17 additions, 0 deletions
src/command.cpp
src/command.h
+1
-0
1 addition, 0 deletions
src/command.h
with
18 additions
and
0 deletions
src/command.cpp
+
17
−
0
View file @
66e03e04
...
...
@@ -162,6 +162,23 @@ Command Command::parseStoreToken(const QJsonObject& input)
);
}
Protocol
::
Command
Protocol
::
Command
::
parseError
(
const
QJsonObject
&
input
)
{
if
(
!
input
.
keys
().
contains
(
QStringLiteral
(
"message"
))
||
!
input
.
value
(
QStringLiteral
(
"message"
)).
isString
())
{
logError
(
QStringLiteral
(
"Error command does not contain message."
));
return
Command
();
}
const
QString
token
=
(
input
.
keys
().
contains
(
QStringLiteral
(
"token"
))
&&
input
.
value
(
QStringLiteral
(
"token"
)).
isString
())
?
input
.
value
(
QStringLiteral
(
"token"
)).
toString
()
:
QString
();
return
Command
(
Action
::
error
,
Arguments
{
std
::
make_pair
(
QStringLiteral
(
"message"
),
input
.
value
(
QStringLiteral
(
"message"
)).
toString
())},
token
);
}
QString
Command
::
toString
()
const
{
if
(
action
==
Action
::
invalid
)
...
...
This diff is collapsed.
Click to expand it.
src/command.h
+
1
−
0
View file @
66e03e04
...
...
@@ -71,6 +71,7 @@ private:
static
Command
parseAuthenticate
(
const
QJsonObject
&
input
);
static
Command
parseStoreToken
(
const
QJsonObject
&
input
);
static
Command
parseError
(
const
QJsonObject
&
input
);
static
QString
getActionString
(
const
Action
action
);
};
...
...
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