From 97923faf2c5ad5d479c7a4e5581e8af738d4fa9f Mon Sep 17 00:00:00 2001 From: xfarrow Date: Thu, 14 Mar 2024 15:51:47 +0100 Subject: [PATCH] Create error_utils.js --- backend/apis/nodejs/src/utils/error_utils.js | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 backend/apis/nodejs/src/utils/error_utils.js diff --git a/backend/apis/nodejs/src/utils/error_utils.js b/backend/apis/nodejs/src/utils/error_utils.js new file mode 100644 index 0000000..e2c3997 --- /dev/null +++ b/backend/apis/nodejs/src/utils/error_utils.js @@ -0,0 +1,28 @@ +/* + This code is part of Blink + licensed under GPLv3 + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. +*/ + +function buildError(type, value, msg, path, location) { + return { + errors: [{ + type, + value, + msg, + path, + location + }] + }; +} + +module.exports = { + buildError +} \ No newline at end of file