-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from SteffenLanger/master
Improved grammar and changed some structure.
- Loading branch information
Showing
12 changed files
with
168 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
module.exports = function (message, code, fields, extraData) { | ||
// Set status code | ||
this.status(400); | ||
this.send({ | ||
error : { | ||
message : message || 'Request could not be handled.', | ||
code : code || undefined, | ||
fields : fields || undefined, | ||
extraData : extraData || undefined | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
/** | ||
* Created by Sergii on 26.04.2015. | ||
*/ | ||
|
||
|
||
module.exports = function(message, extra){ | ||
// Set status code | ||
this.status(403); | ||
this.send({ | ||
error: { | ||
error_message: message, | ||
error_code: 403, | ||
error_extra: extra || null | ||
} | ||
}); | ||
module.exports = function (message, code, extraData) { | ||
// Set status code | ||
this.status(403); | ||
this.send({ | ||
error : { | ||
message : message || 'This request is forbidden.', | ||
code : code || undefined, | ||
extraData : extraData || undefined | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
/** | ||
* Created by Sergii on 26.04.2015. | ||
*/ | ||
|
||
|
||
module.exports = function(name, extra){ | ||
// Set status code | ||
this.status(404); | ||
this.send({ | ||
error: { | ||
error_message: name + ' not found', | ||
error_code: 404, | ||
error_extra: extra || null | ||
} | ||
}); | ||
module.exports = function (uri, extraData) { | ||
// Set status code | ||
this.status(404); | ||
this.send({ | ||
error : { | ||
message : uri + ' not found.', | ||
code : 404, | ||
extraData : extraData || undefined | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
/** | ||
* Created by Sergii on 26.04.2015. | ||
*/ | ||
|
||
|
||
module.exports = function(extra){ | ||
module.exports = function(extraData){ | ||
// Set status code | ||
this.status(200); | ||
this.send(extra || {}); | ||
} | ||
this.send(extraData || undefined); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
/** | ||
* Created by Sergii on 26.04.2015. | ||
*/ | ||
|
||
|
||
module.exports = function(extra){ | ||
// Set status code | ||
this.status(500); | ||
this.send({ | ||
error: { | ||
error_message: 'We\'re sorry, a server error occurred. Please wait a bit and try again', | ||
error_code: 500, | ||
error_extra: extra || null | ||
} | ||
}); | ||
} | ||
module.exports = function (message, code, extraData) { | ||
// Set status code | ||
this.status(500); | ||
if(extraData instanceof Error) { | ||
extraData = extraData.toString(); | ||
} | ||
this.send({ | ||
error : { | ||
message : message || 'We\'re sorry, a server error occurred. Please wait a bit and try again.', | ||
code : code || undefined, | ||
extraData : extraData || undefined | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = function (message, code, extraData) { | ||
// Set status code | ||
this.status(401); | ||
this.send({ | ||
error : { | ||
message : message || 'Unauthorized..', | ||
code : code || undefined, | ||
extraData : extraData || undefined | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"use strict"; | ||
|
||
module.exports = function (message, extraData) { | ||
// Set status code | ||
this.status(422); | ||
this.send({ | ||
error : { | ||
message : message || 'The request is logically intact. However, it asks the server to execute an action which is not allowed by application logic.', | ||
extraData : extraData || undefined | ||
} | ||
}); | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.