Created
October 6, 2016 11:13
-
-
Save nalply/a420a73d83c82e2c9cd50b14e7b57a8e to your computer and use it in GitHub Desktop.
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
makeErrorByStatus = function(statusCode, content) { | |
let message = `failed [${statusCode}]`; | |
if (content) { | |
const stringContent = typeof content == "string" ? | |
content : content.toString(); | |
message += ' ' + truncate(stringContent.replace(/\n/g, ' '), MAX_LENGTH); | |
} | |
return new Error(message); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment