Gross error

One of the great themes of the web these days is harmony, which leads to unwavering work. In doing so, a number of errors may occur. Instead of providing common errors, you’d better provide information about the error. OfAggregateError Error allows developers to throw multiple errors in a single. Error. Let’s see how it works.

To throw an error that represents multiple errors, let’s use “” “” “” “”.AggregateError:

const error = new AggregateError([
  new Error('ERROR_11112'),
  new TypeError('First name must be a string'),
  new RangeError('Transaction value must be at least 1'),
  new URIError('User profile link must be https'),
], 'Transaction cannot be processed')

Throwing a “”AggregateError You get the following information:

error instanceof AggregateError // true // 'AggregateError'
error.message // 'Transaction cannot be processed'
error.errors // The array of errors

Of AggregateError Incredibly useful when verifying multiple sets of data, instead of throwing one error at a time, grouping them into one is ideal! AggregateError a would be really useful. Promise.any Situational communication, informative errors FTW!

Monitor website performance
Monitor website performance
Monitor website performance
  • Create Shane logo effect with CSS.
  • 7 Essential JavaScript functions

    7 Essential JavaScript functions

    I remember the early days of JavaScript where you needed a simple function for almost everything because browser vendors implemented features differently, not just edge features, basic features, like addEventListener And attachEvent. Times have changed but there are still some things every developer should do …

  • Create a keyboard shortcut with the mouse trap.

    Create a keyboard shortcut with the mouse trap.

    Some of the best parts of web apps are hidden in the little things. These “small details” can often add to the big, big benefits. One of these small benefits can be found in keyboard shortcuts. Great web apps like Gmail and GutHub are used a lot.

  • Create a Twitter style dropdown using MooTools.

    Create a Twitter style dropdown using MooTools.

    Twitter does some great things with JavaScript. What I really appreciate about what I do is that there is no epic JS functionality – it’s all simple communication. One of these simple contacts is the “Login” dropdown on their homepage. I have taken …

Write a Comment

Your email address will not be published. Required fields are marked *