Skip to content
Snippets Groups Projects
Commit 9d73e017 authored by Erick Hitter's avatar Erick Hitter
Browse files

Improve errors

parent 722b75df
No related branches found
No related tags found
1 merge request!5Limit to a given user, and improve feedback
...@@ -28,7 +28,12 @@ app.get( '/', function( req, res ) { ...@@ -28,7 +28,12 @@ app.get( '/', function( req, res ) {
app.post( '/log', function( req, res ) { app.post( '/log', function( req, res ) {
// Don't bother if there's nothing to record // Don't bother if there's nothing to record
if ( 'undefined' === typeof req.body || 'undefined' === typeof req.body.text || ! req.body.text.length ) { if ( 'undefined' === typeof req.body || 'undefined' === typeof req.body.text || ! req.body.text.length ) {
return res.sendStatus( 400 ); var response = {
"response_type": "ephemeral",
"text": "Please provide something to record."
};
return res.status( 400 ).send( response );
} }
// Limit who can trigger the command // Limit who can trigger the command
...@@ -38,7 +43,7 @@ app.post( '/log', function( req, res ) { ...@@ -38,7 +43,7 @@ app.post( '/log', function( req, res ) {
"text": "Sorry, you can't record completed tasks." "text": "Sorry, you can't record completed tasks."
}; };
return res.send( response ); return res.status( 403 ).send( response );
} }
// Massage the title // Massage the title
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment