I am trying to implement 422 because Konstrukt doesn't seem to (Ruby
on Rails' ActiveResource expects errors on save to return an errors
object with this code). My difficulty is in getting my errors into the
error-handling component: In the code below, the $errors attribute is
not found in UnprocessableEntity's dispatch method with "Undefined
property: k_HttpRequest::$errors."
What am I doing wrong?
In the component that generates the errors:
function postXml() {
// Omitted $record-building logic
try {
$record->save();
} catch(Doctrine_Validator_Exception $e) {
// Omitted $error-building logic
$this->xml->serialize($errors);
$this->context->errors = $this->xml->getSerializedData();
throw new Unprocessable();
}
}
The MetaResponse:
class Unprocessable extends k_MetaResponse {
function componentName() {
return 'Unprocessable_Entity';
}
}
And finally, the component that is trying to implement 422 (it does
set the error code successfully):
class Unprocessable_Entity extends App {
function dispatch() {
$response = new k_XmlResponse($this->context->errors);
$response->setStatus(422);
return $response;
}
}
So does anybody have an idea as to why I cannot access the errors
attribute here, and what I might be able to do to share this data,
short of using globals (my unfortunate stopgap solution)?
Thomas
--
You received this message because you are subscribed to the Google Groups "Konstrukt" group.
To post to this group, send email to
kons...@googlegroups.com.
To unsubscribe from this group, send email to
konstrukt+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/konstrukt?hl=en.