Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function deserializeResults(results): ?SpecsResultsWithMetaData {
if (!results) return undefined;
if (results.type === 'error') {
let deserializedError = deserializeError(results.error);
// Special desrialization for external errors
if (deserializedError.originalErrors) {
const deserializedOriginalErrors = deserializedError.originalErrors.map(deserializeError);
if (results.error.name === ExternalBuildErrors.name) {
deserializedError = new ExternalBuildErrors(deserializedError.id, deserializedOriginalErrors);
} else if (results.error.name === ExternalTestErrors.name) {
deserializedError = new ExternalTestErrors(deserializedError.id, deserializedOriginalErrors);
} else {
deserializedError = new ExternalErrors(deserializedOriginalErrors);
}
}
if (deserializedError.originalError) {
const deserializedOriginalError = deserializeError(deserializedError.originalError);
const compName =
deserializedError.compName && typeof deserializedError.compName === 'string' ? deserializedError.compName : '';
deserializedError = new ExternalTestErrors(compName, [deserializedOriginalError]);
function deserializeResults(results): SpecsResultsWithMetaData | null | undefined {
if (!results) return undefined;
if (results.type === 'error') {
let deserializedError = deserializeError(results.error);
// Special desrialization for external errors
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
if (deserializedError.originalErrors) {
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
const deserializedOriginalErrors = deserializedError.originalErrors.map(deserializeError);
if (results.error.name === ExternalBuildErrors.name) {
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
deserializedError = new ExternalBuildErrors(deserializedError.id, deserializedOriginalErrors);
} else if (results.error.name === ExternalTestErrors.name) {
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
deserializedError = new ExternalTestErrors(deserializedError.id, deserializedOriginalErrors);
} else {
deserializedError = new ExternalErrors(deserializedOriginalErrors);
}
}
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
const deserializedOriginalErrors = deserializedError.originalErrors.map(deserializeError);
if (results.error.name === ExternalBuildErrors.name) {
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
deserializedError = new ExternalBuildErrors(deserializedError.id, deserializedOriginalErrors);
} else if (results.error.name === ExternalTestErrors.name) {
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
deserializedError = new ExternalTestErrors(deserializedError.id, deserializedOriginalErrors);
} else {
deserializedError = new ExternalErrors(deserializedOriginalErrors);
}
}
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
if (deserializedError.originalError) {
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
const deserializedOriginalError = deserializeError(deserializedError.originalError);
const compName =
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
deserializedError.compName && typeof deserializedError.compName === 'string' ? deserializedError.compName : '';
deserializedError = new ExternalTestErrors(compName, [deserializedOriginalError]);
}
const finalResults = {
type: 'error',
error: deserializedError
};
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
return finalResults;
}
const deserializeFailure = failure => {
if (!failure) return undefined;
if (!results) return undefined;
if (results.type === 'error') {
let deserializedError = deserializeError(results.error);
// Special desrialization for external errors
if (deserializedError.originalErrors) {
const deserializedOriginalErrors = deserializedError.originalErrors.map(deserializeError);
if (results.error.name === ExternalBuildErrors.name) {
deserializedError = new ExternalBuildErrors(deserializedError.id, deserializedOriginalErrors);
} else if (results.error.name === ExternalTestErrors.name) {
deserializedError = new ExternalTestErrors(deserializedError.id, deserializedOriginalErrors);
} else {
deserializedError = new ExternalErrors(deserializedOriginalErrors);
}
}
if (deserializedError.originalError) {
const deserializedOriginalError = deserializeError(deserializedError.originalError);
const compName =
deserializedError.compName && typeof deserializedError.compName === 'string' ? deserializedError.compName : '';
deserializedError = new ExternalTestErrors(compName, [deserializedOriginalError]);
}
const finalResults = {
type: 'error',
error: deserializedError
};
return finalResults;
}
const deserializeFailure = (failure) => {
if (!failure) return undefined;
const deserializedFailure = failure;
if (failure.err) {
try {
deserializedFailure.err = deserializeError(failure.err);
const deserializeFailure = (failure) => {
if (!failure) return undefined;
const deserializedFailure = failure;
if (failure.err) {
try {
deserializedFailure.err = deserializeError(failure.err);
} catch (e) {
logger.debug(`fail parsing error ${deserializedFailure.err}`);
}
}
return deserializedFailure;
};
ipc.once(errorChannel, (event, error) => {
onError(event, deserializeError(error));
});