Sha256: fc4099e36d6def7a4b6103501933a5ef46737bb1755b3dd213e857052cfeca69

Contents?: true

Size: 800 Bytes

Versions: 25

Compression:

Stored size: 800 Bytes

Contents

#include "InvocationResult.h"
#include "ErrorMessage.h"

InvocationResult::InvocationResult(QVariant result, bool error) {
  m_result = result;
  m_error = error;
}

const QVariant &InvocationResult::result() const {
  return m_result;
}

bool InvocationResult::hasError() {
  return m_error;
}

ErrorMessage *InvocationResult::errorMessage() {
  if (!m_result.canConvert<QVariantMap>())
    return new ErrorMessage(m_result.toString());

  QVariantMap error = m_result.toMap();

  QString message = error["message"].toString();

  if (error["name"] == "Capybara.ClickFailed")
    return new ErrorMessage("ClickFailed", message);
  else if (error["name"] == "Capybara.NodeNotAttachedError")
    return new ErrorMessage("NodeNotAttachedError", message);
  else
    return new ErrorMessage(message);
}

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
capybara-webkit-1.15.1 src/InvocationResult.cpp
capybara-webkit-1.15.0 src/InvocationResult.cpp
capybara-webkit-1.14.0 src/InvocationResult.cpp
capybara-webkit-1.13.0 src/InvocationResult.cpp
capybara-webkit-1.12.0 src/InvocationResult.cpp
capybara-webkit-1.11.1 src/InvocationResult.cpp
capybara-webkit-1.11.0 src/InvocationResult.cpp
capybara-webkit-1.10.1 src/InvocationResult.cpp
capybara-webkit-1.10.0 src/InvocationResult.cpp
capybara-webkit-1.9.0 src/InvocationResult.cpp
capybara-webkit-1.8.0 src/InvocationResult.cpp
capybara-webkit-1.7.1 src/InvocationResult.cpp
capybara-webkit-1.7.0 src/InvocationResult.cpp
capybara-webkit-1.6.0 src/InvocationResult.cpp
capybara-webkit-1.5.2 src/InvocationResult.cpp
capybara-webkit-1.5.1 src/InvocationResult.cpp
capybara-webkit-1.5.0 src/InvocationResult.cpp
capybara-webkit-1.4.1 src/InvocationResult.cpp
capybara-webkit-1.4.0 src/InvocationResult.cpp
capybara-webkit-1.3.1 src/InvocationResult.cpp