New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gqutils

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gqutils - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

42

dist/errors.js

@@ -16,15 +16,27 @@ 'use strict';

let message = error.message;
const keyword = error.keyword;
const params = error.params;
if (!error.keyword) {
if (!keyword) {
return { message };
}
if (error.keyword === 'required') {
if (keyword === 'required') {
message = `${field} is required`;
} else if (error.keyword === 'type') {
const type = error.params.type;
} else if (keyword === 'type') {
const type = params.type;
message = `${field} should be of type ${type}`;
} else if (error.keyword === 'format') {
const format = error.params.format;
} else if (keyword === 'format') {
const format = params.format;
message = `${field} should be a valid ${format}`;
} else if (keyword === 'minLength') {
const limit = params.limit;
if (limit === 1) {
message = `${field} is required`;
} else {
message = `${field} must be larger than ${limit} chars`;
}
} else if (keyword === 'maxLength') {
const limit = params.limit;
message = `${field} must be shorter than ${limit} chars`;
}

@@ -38,5 +50,3 @@

if (process.env.NODE_ENV !== 'production') {
error._stack = error.stack;
}
const isDev = process.env.NODE_ENV !== 'production';

@@ -47,2 +57,7 @@ const originalError = error.originalError || error;

if (isDev) {
error._stack = error.stack;
error._type = errorType;
}
if (errorType === 'ValidationError' || errorType === 'UserError') {

@@ -65,2 +80,7 @@ if (_lodash2.default.isString(message)) {

if (isDev) {
error._originalData = originalError.data;
error._originalMessage = originalError.message;
}
error.message = 'Your query has errors';

@@ -101,2 +121,6 @@ } else if (errorType === 'GraphQLError' && _lodash2.default.isString(message)) {

} else {
if (isDev) {
error._originalMessage = error.message;
}
error.message = 'Server error';

@@ -103,0 +127,0 @@ error.fields.global = {

{
"name": "gqutils",
"version": "0.2.4",
"version": "0.2.5",
"description": "Utilities For GraphQL",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -5,18 +5,33 @@ import _ from 'lodash';

let message = error.message;
const keyword = error.keyword;
const params = error.params;
if (!error.keyword) {
if (!keyword) {
return {message};
}
if (error.keyword === 'required') {
if (keyword === 'required') {
message = `${field} is required`;
}
else if (error.keyword === 'type') {
const type = error.params.type;
else if (keyword === 'type') {
const type = params.type;
message = `${field} should be of type ${type}`;
}
else if (error.keyword === 'format') {
const format = error.params.format;
else if (keyword === 'format') {
const format = params.format;
message = `${field} should be a valid ${format}`;
}
else if (keyword === 'minLength') {
const limit = params.limit;
if (limit === 1) {
message = `${field} is required`;
}
else {
message = `${field} must be larger than ${limit} chars`;
}
}
else if (keyword === 'maxLength') {
const limit = params.limit;
message = `${field} must be shorter than ${limit} chars`;
}

@@ -29,5 +44,3 @@ return {message};

if (process.env.NODE_ENV !== 'production') {
error._stack = error.stack;
}
const isDev = process.env.NODE_ENV !== 'production';

@@ -38,2 +51,7 @@ const originalError = error.originalError || error;

if (isDev) {
error._stack = error.stack;
error._type = errorType;
}
if (errorType === 'ValidationError' || errorType === 'UserError') {

@@ -59,2 +77,7 @@ if (_.isString(message)) {

if (isDev) {
error._originalData = originalError.data;
error._originalMessage = originalError.message;
}
error.message = 'Your query has errors';

@@ -97,2 +120,6 @@ }

else {
if (isDev) {
error._originalMessage = error.message;
}
error.message = 'Server error';

@@ -99,0 +126,0 @@ error.fields.global = {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc