diff --git a/src/command.cpp b/src/command.cpp
index 764e7f2834c9b7ff26bdfbaaf3d4f47db067a164..b00164406bfd3116712f56d45b5c2fba6dcb1c65 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -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)
diff --git a/src/command.h b/src/command.h
index 9c34b0e39a71f603c8b0c7e791ea091c3610551e..0fd7830b22c91827ec264590fef2fa3c9b0ff3e5 100644
--- a/src/command.h
+++ b/src/command.h
@@ -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);
 };