source: frontend/node_modules/webpack/lib/serialization/AggregateErrorSerializer.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[9af201e]1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3*/
4
5"use strict";
6
7/** @typedef {import("./ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
8/** @typedef {import("./ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
9
10/** @typedef {Error & { cause?: unknown, errors: EXPECTED_ANY[] }} AggregateError */
11
12class AggregateErrorSerializer {
13 /**
14 * Serializes this instance into the provided serializer context.
15 * @param {AggregateError} obj error
16 * @param {ObjectSerializerContext} context context
17 */
18 serialize(obj, context) {
19 context.write(obj.errors);
20 context.write(obj.message);
21 context.write(obj.stack);
22 context.write(obj.cause);
23 }
24
25 /**
26 * Restores this instance from the provided deserializer context.
27 * @param {ObjectDeserializerContext} context context
28 * @returns {AggregateError} error
29 */
30 deserialize(context) {
31 const errors = context.read();
32 // eslint-disable-next-line n/no-unsupported-features/es-builtins, n/no-unsupported-features/es-syntax, unicorn/error-message
33 const err = new AggregateError(errors);
34
35 err.message = context.read();
36 err.stack = context.read();
37 err.cause = context.read();
38
39 return err;
40 }
41}
42
43module.exports = AggregateErrorSerializer;
Note: See TracBrowser for help on using the repository browser.