Permalink
Browse files

Add example for haXe returning an error object

  • Loading branch information...
1 parent 08d6c0d commit 48c117d9032595b1d3d7029f908756a67adb7893 Paul Hampson committed Nov 9, 2009
Showing with 4 additions and 0 deletions.
  1. +1 −0 www/haxe_sample.html
  2. +3 −0 www/haxe_sample.yaws
View
@@ -14,6 +14,7 @@
var a = {a:"foo", b:"bar", c:[1,2,3]};
var b = "hello, Erlang!";
cnx.echo.call([a, b], display);
+ cnx.failure.call([a, b], display);
}
static function display(v) {
View
@@ -5,6 +5,9 @@ out(A) ->
A1 = A#arg{state = {new_state, "alive and kicking"}},
yaws_rpc:handler(A1, {haxe_sample, respond}).
+respond(State, {call, failure, Value} = _Request) ->
+ { false, { error, { struct, [ { message, "Failure" }, { code, 500 } ] } } };
+
respond(State, {call, echo, Value} = _Request) ->
{new_state, StateVal} = State,
{array, [First, Second]} = Value,

0 comments on commit 48c117d

Please sign in to comment.