How to use the node-errors-helpers.createErrorsList function in node-errors-helpers

To help you get started, we’ve selected a few node-errors-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Travelport-Ukraine / uapi-json / src / Services / Hotels / HotelsErrors.js View on Github external
);
Object.assign(HotelsParsingError, createErrorsList({
  SearchParsingError: 'Cant parse XML response. #HotelsParser.searchParse()',
  MediaParsingError: 'Cant parse XML response. #HotelsParser.mediaParse()',
  RateParsingError: 'Cant parse XML response. #HotelsParser.rateParse()',
  BookingParsingError: 'Cant parse XML response. #HotelsParser.bookParse()',
  CancelBookingParsingError: 'Cant parse XML response. #HotelsParser.cancelBookParse()',
}, HotelsParsingError));

// Runtime errors
const HotelsRuntimeError = createErrorClass(
  'HotelsRuntimeError',
  'Hotels service runtime error',
  errorTypes.RuntimeError
);
Object.assign(HotelsRuntimeError, createErrorsList({
  NoEnginesResults: 'None of the enabled engines could fulfill your request',
  NoResultsFound: 'No results found',
}, HotelsRuntimeError));

export default {
  HotelsValidationError,
  HotelsParsingError,
  HotelsRuntimeError,
};
github Travelport-Ukraine / uapi-json / src / Services / Utils / UtilsErrors.js View on Github external
const {
  createErrorClass,
  createErrorsList,
} = require('node-errors-helpers');
const errorTypes = require('../../error-types');

// Validation errors
const UtilsValidationError = createErrorClass(
  'UtilsValidationError',
  'Utils service validation error',
  errorTypes.ValidationError
);
Object.assign(UtilsValidationError, createErrorsList({
  CurrenciesMissing: 'Missing currencies',
}, UtilsValidationError));

// Parsing errors
const UtilsParsingError = createErrorClass(
  'UtilsParsingError',
  'Utils service parsing error',
  errorTypes.ParsingError
);

// Runtime errors
const UtilsRuntimeError = createErrorClass(
  'UtilsRuntimeError',
  'Utils service runtime error',
  errorTypes.RuntimeError
);
github Travelport-Ukraine / uapi-json / src / Services / Air / AirErrors.js View on Github external
'GdsValidationError',
  ['Gds service validation error', 200],
  errorTypes.ValidationError
);
Object.assign(GdsValidationError, createErrorsList({
  PnrMissing: 'PNR is missing in request',
  QueueMissing: 'Queue is missing in request',
  PccMissing: 'Pcc is missing in request',
}, GdsValidationError));

const AirFlightInfoValidationError = createErrorClass(
  'AirFlightInfoValidationError',
  ['Air FlightInfo service validation error', 200],
  errorTypes.ValidationError
);
Object.assign(AirFlightInfoValidationError, createErrorsList({
  AirlineMissing: 'Airline is missing in request',
  FlightNumberMissing: 'Flight number is missing in request',
  DepartureMissing: 'Departure is missing in request',
}, AirFlightInfoValidationError));

// Parsing errors
const AirParsingError = createErrorClass(
  'AirParsingError',
  'Air service parsing error',
  errorTypes.ParsingError
);
Object.assign(AirParsingError, createErrorsList({
  ResponseDataMissing: 'One of main data arrays is missing in parsed XML response',
  ReservationsMissing: 'Reservations missing in response',
  BookingInfoError: 'air:BookingInfo should be an array',
  PlatingCarriersError: 'Plating carriers do not coincide across all passenger reservations',
github Travelport-Ukraine / uapi-json / src / Services / Hotels / HotelsErrors.js View on Github external
PrefixNameMissing: 'Missing PrefixName in request',
  NationalityMissing: 'Missing Nationality in request',
  BirthDateMissing: 'Missing BirthDate in request',
}, TravellersError));
Object.assign(ContactError, createErrorsList({
  AreaCodeMissing: 'Missing AreaCode in request',
  CountryCodeMissing: 'Missing CountryCode in request',
  NumberMissing: 'Missing Number in request',
  EmailMissing: 'Missing Email in request',
  CountryMissing: 'Missing Country in request',
  CountryInvalid: 'Invalid Country in request',
  CityMissing: 'Missing City in request',
  StreetMissing: 'Missing Street in request',
  PostalCodeMissing: 'Missing PostalCode in request',
}, ContactError));
Object.assign(PaymentDataError, createErrorsList({
  GuaranteeMissing: 'Missing Guarantee',
  CvvMissing: 'Missing CVV',
  CvvInvalid: 'Invalid CVV',
  ExpDateMissing: 'Missing ExpDate',
  CardNumberMissing: 'Missing CardNumber',
  CardTypeMissing: 'Missing CardType',
  CardTypeInvalid: 'Invalid CardType',
  CardHolderMissing: 'Missing CardHolder',
}, PaymentDataError));

// Parsing errors
const HotelsParsingError = createErrorClass(
  'HotelsParsingError',
  'Hotels service parsing error',
  errorTypes.ParsingError
);
github Travelport-Ukraine / uapi-json / src / Services / Air / AirErrors.js View on Github external
['Air FlightInfo service validation error', 200],
  errorTypes.ValidationError
);
Object.assign(AirFlightInfoValidationError, createErrorsList({
  AirlineMissing: 'Airline is missing in request',
  FlightNumberMissing: 'Flight number is missing in request',
  DepartureMissing: 'Departure is missing in request',
}, AirFlightInfoValidationError));

// Parsing errors
const AirParsingError = createErrorClass(
  'AirParsingError',
  'Air service parsing error',
  errorTypes.ParsingError
);
Object.assign(AirParsingError, createErrorsList({
  ResponseDataMissing: 'One of main data arrays is missing in parsed XML response',
  ReservationsMissing: 'Reservations missing in response',
  BookingInfoError: 'air:BookingInfo should be an array',
  PlatingCarriersError: 'Plating carriers do not coincide across all passenger reservations',
  PTCIsNotSet: 'Code not set for PassengerTypeCode item',
  PlatingCarrierNotSet: 'PlatingCarrier is not set for AirPricingInfo item',
  PTCTypeInvalid: 'PassengerTypeCode is supposed to be a string or array of PassengerTypeCode items',
  HistogramTypeInvalid: 'PassengerType is supposed to be an array',
  MultiplePricingSolutionsNotAllowed: 'Expected only one pricing solution, need to clarify search?',
  PricingSolutionNotFound: 'Pricing solution not found',
  ReservationProviderInfoMissing: 'Can\'t find provider information about reservation',
  CancelResponseNotFound: 'Cancel response not found',
  InvalidServiceSegmentFormat: 'Service segment format is invalid',
}, AirParsingError));

// Runtime errors
github Travelport-Ukraine / uapi-json / src / Services / Terminal / TerminalErrors.js View on Github external
'TerminalParsingError',
  'Terminal service parsing error',
  errorTypes.ParsingError
);
Object.assign(TerminalParsingError, createErrorsList({
  TerminalSessionTokenMissing: 'Terminal session token is missing in service response',
  TerminalResponseMissing: 'Terminal response is missing in service response',
}, TerminalParsingError));

// Runtime errors
const TerminalRuntimeError = createErrorClass(
  'TerminalRuntimeError',
  'Terminal service runtime error',
  errorTypes.RuntimeError
);
Object.assign(TerminalRuntimeError, createErrorsList({
  TerminalEmulationFailed: 'Terminal emulation failed',
  TerminalCloseSessionFailed: 'Failed to close terminal session',
  TerminalIsBusy: 'Terminal is busy',
  TerminalIsClosed: 'Terminal is closed',
  ErrorClosingSession: 'Error closing session',
  NoAgreement: 'There is no agreement between current pcc and you trying to reach',
}, TerminalRuntimeError));

module.exports = {
  TerminalValidationError,
  TerminalParsingError,
  TerminalRuntimeError,
};
github Travelport-Ukraine / uapi-json / src / Services / Hotels / HotelsErrors.js View on Github external
CvvMissing: 'Missing CVV',
  CvvInvalid: 'Invalid CVV',
  ExpDateMissing: 'Missing ExpDate',
  CardNumberMissing: 'Missing CardNumber',
  CardTypeMissing: 'Missing CardType',
  CardTypeInvalid: 'Invalid CardType',
  CardHolderMissing: 'Missing CardHolder',
}, PaymentDataError));

// Parsing errors
const HotelsParsingError = createErrorClass(
  'HotelsParsingError',
  'Hotels service parsing error',
  errorTypes.ParsingError
);
Object.assign(HotelsParsingError, createErrorsList({
  SearchParsingError: 'Cant parse XML response. #HotelsParser.searchParse()',
  MediaParsingError: 'Cant parse XML response. #HotelsParser.mediaParse()',
  RateParsingError: 'Cant parse XML response. #HotelsParser.rateParse()',
  BookingParsingError: 'Cant parse XML response. #HotelsParser.bookParse()',
  CancelBookingParsingError: 'Cant parse XML response. #HotelsParser.cancelBookParse()',
}, HotelsParsingError));

// Runtime errors
const HotelsRuntimeError = createErrorClass(
  'HotelsRuntimeError',
  'Hotels service runtime error',
  errorTypes.RuntimeError
);
Object.assign(HotelsRuntimeError, createErrorsList({
  NoEnginesResults: 'None of the enabled engines could fulfill your request',
  NoResultsFound: 'No results found',
github Travelport-Ukraine / uapi-json / src / Services / Air / AirErrors.js View on Github external
NoResidualValue: 'The original ticket has no residual value for this specific itinerary. Issue a new ticket using current fares.',
  TicketsNotIssued: 'Host error during ticket retrieve.',
  CantDetectExchangeResponse: 'Exchange response is unknown.',
  ExchangeTokenIncorrect: 'Can\'t parse exchange token. Please resolve it again.',
  DuplicateTicketFound: 'Duplicate ticket number found. Provide PNR, UR locator',
  NoPNRFoundInUR: ['No PNR found in Universal record', 404],
  NoAgreement: 'There is no agreement between current pcc, and one you try to reach',
  UnableToRetrieve: ['Unable to retrieve PNR. Please contact your local Travelport Helpdesk.', 404],
}, AirRuntimeError));

const AirFlightInfoRuntimeError = createErrorClass(
  'AirFlightInfoRuntimeError',
  ['Air flight info service runtime error', 598],
  errorTypes.RuntimeError
);
Object.assign(AirFlightInfoRuntimeError, createErrorsList({
  FlightNotFound: 'Flight not found',
  AirlineNotSupported: 'Airline not supported',
  InvalidFlightNumber: 'Invalid flight number',
}, AirFlightInfoRuntimeError));

const GdsRuntimeError = createErrorClass(
  'GdsRuntimeError',
  ['Gds service runtime error', 599],
  errorTypes.RuntimeError
);
Object.assign(GdsRuntimeError, createErrorsList({
  PlacingInQueueMessageMissing: 'Placing success message missing',
  PlacingInQueueError: 'Error during placing in queue request',
}, GdsRuntimeError));

module.exports = {
github Travelport-Ukraine / uapi-json / src / Services / Hotels / HotelsErrors.js View on Github external
RatePlanTypeMissing: 'Missing RatePlanType',
  RateOfferIdMissing: 'Missing RateOfferId',
  HostTokenMissing: 'Missing HostToken',
}, HotelsValidationError));
Object.assign(TravellersError, createErrorsList({
  AdultsMissing: 'Missing adults in request',
  ChildrenTypeInvalid: 'Invalid type for children in request',
  ChildrenAgeInvalid: 'One or more child in request has invalid age',
  TravellersMissing: 'Missing travellers in request',
  FirstNameMissing: 'Missing FirstName in request',
  LastNameMissing: 'Missing LastName in request',
  PrefixNameMissing: 'Missing PrefixName in request',
  NationalityMissing: 'Missing Nationality in request',
  BirthDateMissing: 'Missing BirthDate in request',
}, TravellersError));
Object.assign(ContactError, createErrorsList({
  AreaCodeMissing: 'Missing AreaCode in request',
  CountryCodeMissing: 'Missing CountryCode in request',
  NumberMissing: 'Missing Number in request',
  EmailMissing: 'Missing Email in request',
  CountryMissing: 'Missing Country in request',
  CountryInvalid: 'Invalid Country in request',
  CityMissing: 'Missing City in request',
  StreetMissing: 'Missing Street in request',
  PostalCodeMissing: 'Missing PostalCode in request',
}, ContactError));
Object.assign(PaymentDataError, createErrorsList({
  GuaranteeMissing: 'Missing Guarantee',
  CvvMissing: 'Missing CVV',
  CvvInvalid: 'Invalid CVV',
  ExpDateMissing: 'Missing ExpDate',
  CardNumberMissing: 'Missing CardNumber',
github Travelport-Ukraine / uapi-json / src / Services / Air / AirErrors.js View on Github external
DeliveryInformation: 'Missing of delivery information fields. See data.',
  UniversalRecordLocatorCode: 'Missing UniversalRecordLocatorCode in request. See data.',
  ReservationLocator: 'Missing uapi_reservation_locator/reservationLocatorCode in request. See data.',
  ExchangeToken: 'Missing exchangeToken in request. See data.',
  CreditCardMissing: 'Missing creditCard in request. See data.',
  IncorrectConnectionsFormat: 'Connections should be an array with IATA codes.',
  PlatingCarrierInvalid: 'Plating Carrier Invalid',
  SearchIdMissing: 'SearchId is missing'
}, AirValidationError));

const GdsValidationError = createErrorClass(
  'GdsValidationError',
  ['Gds service validation error', 200],
  errorTypes.ValidationError
);
Object.assign(GdsValidationError, createErrorsList({
  PnrMissing: 'PNR is missing in request',
  QueueMissing: 'Queue is missing in request',
  PccMissing: 'Pcc is missing in request',
}, GdsValidationError));

const AirFlightInfoValidationError = createErrorClass(
  'AirFlightInfoValidationError',
  ['Air FlightInfo service validation error', 200],
  errorTypes.ValidationError
);
Object.assign(AirFlightInfoValidationError, createErrorsList({
  AirlineMissing: 'Airline is missing in request',
  FlightNumberMissing: 'Flight number is missing in request',
  DepartureMissing: 'Departure is missing in request',
}, AirFlightInfoValidationError));

node-errors-helpers

Some helpers for better error handling in Node.js

MIT
Latest version published 4 years ago

Package Health Score

46 / 100
Full package analysis