mirror of
https://github.com/appium/appium.git
synced 2026-02-11 20:39:04 -06:00
make error message returned as part of value
This commit is contained in:
@@ -76,6 +76,8 @@ var respondError = function(req, res, statusObj, value) {
|
||||
|
||||
if (typeof newValue === "object") {
|
||||
newValue = _.extend({message: message}, value);
|
||||
} else {
|
||||
newValue = {message: message, origValue: value};
|
||||
}
|
||||
var response = {status: code, value: newValue};
|
||||
response.sessionId = getSessionId(req, response);
|
||||
@@ -633,8 +635,10 @@ exports.notYetImplemented = function(req, res) {
|
||||
res.send(501, {
|
||||
status: status.codes.UnknownError.code
|
||||
, sessionId: getSessionId(req)
|
||||
, value: "Not yet implemented. " +
|
||||
"Please help us: http://appium.io/get-involved.html"
|
||||
, value: {
|
||||
message: "Not yet implemented. " +
|
||||
"Please help us: http://appium.io/get-involved.html"
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -644,8 +648,10 @@ var notImplementedInThisContext = function(req, res) {
|
||||
res.send(501, {
|
||||
status: status.codes.UnknownError.code
|
||||
, sessionId: getSessionId(req)
|
||||
, value: "Not implemented in this context, try switching " +
|
||||
"into or out of a web view"
|
||||
, value: {
|
||||
message: "Not implemented in this context, try switching " +
|
||||
"into or out of a web view"
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
var assert = require("assert")
|
||||
, describeWd = require("../../helpers/driverblock.js").describeForApp('TestApp')
|
||||
, should = require('should')
|
||||
, _ = require("underscore");
|
||||
|
||||
describeWd('calc app', function(h) {
|
||||
@@ -192,4 +193,12 @@ describeWd('calc app', function(h) {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should receive correct error', function(done) {
|
||||
h.driver.execute("mobile: doesn't exist", function(err) {
|
||||
should.exist(err);
|
||||
err.cause.value.message.should.equal("Not yet implemented. Please help us: http://appium.io/get-involved.html");
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user