Skip to content

Commit fb58f9c

Browse files
committed
Fix the examples and use the same names
Signed-off-by: Fabio José <[email protected]>
1 parent 852cad0 commit fb58f9c

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

README.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -183,23 +183,20 @@ var Unmarshaller02 = require("cloudevents-sdk/http/unmarshaller/v02");
183183
// some parts were removed //
184184

185185
app.post('/', function (req, res) {
186-
try {
187-
// Using the Unmarshaller
188-
var cloudevent =
189-
unmarshaller.unmarshall(req.body, req.headers);
186+
unmarshaller.unmarshall(req.body, req.headers)
187+
.then(cloudevent => {
190188

191-
// pretty print
192-
console.log("Event Accepted:");
193-
194-
res.status(201)
195-
.send("Event Accepted");
196-
}catch(e) {
197-
console.error(e);
189+
// TODO use the cloudevent
198190

191+
res.status(201)
192+
.send("Event Accepted");
193+
})
194+
.catch(err => {
195+
console.error(err);
199196
res.status(400)
200197
.header("Content-Type", "application/json")
201-
.send(JSON.stringify(e));
202-
}
198+
.send(JSON.stringify(err));
199+
});
203200
});
204201

205202

0 commit comments

Comments
 (0)