incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregor Martynus <gre...@martynus.net>
Subject update handler: how to return a status code?
Date Mon, 03 Oct 2011 18:50:14 GMT
This is my update handler

function (doc, req) {
  var resp;
  if (doc == null) {
    doc = {};
  }
  if (doc.email) {
    resp = {
      status: 403,
      body: 'already signed up with ' + doc.email
    };
    return [doc, resp];
  } else {
    ...
  }
}

Instead of a response with an 403 error, I get a 500 with this content:
{"error":"external_response_error","reason":"Invalid data from external
server: {<<\"status\">>,403}"}

The logs don't tell more neither.

Is this a bug or is it simply not intended to work this way?

– Gregor



PS: Just figured out that it works like that:
throw(['error', 'forbidden','already signed up with ' + doc.email)

I'd still appreciate an explanation

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message