From 3027d8d50603c480b5168ba3d28b2d47be0646ce Mon Sep 17 00:00:00 2001 From: Benjamin Reed Date: Wed, 13 Feb 2019 11:21:17 -0500 Subject: [PATCH] feat(test): improve error reporting in MockHTTP --- test/rest/MockHTTP.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/rest/MockHTTP.ts b/test/rest/MockHTTP.ts index 1a201b21..d6e265af 100644 --- a/test/rest/MockHTTP.ts +++ b/test/rest/MockHTTP.ts @@ -18,7 +18,17 @@ import { StreamResponse } from '../../src/model/StreamResponse'; const getError = (method: string, urlObj: any, options?: TwitarrHTTPOptions) => { // tslint:disable-next-line - return new Error('Not yet implemented: ' + method + ' ' + urlObj.toString() + ': ' + JSON.stringify(options.parameters) + ' ' + JSON.stringify(options.data)); + let message = 'Net yet implemented: ' + method + ' ' + urlObj.toString(); + if (options) { + message += ': '; + if (options.parameters) { + message += 'parameters=' + JSON.stringify(options.parameters); + } + if (options.data) { + message += 'data=' + JSON.stringify(options.data); + } + } + return new Error(message); }; const jsonOK = (contents: any) => {