UNPKG

@salesforce/apex-node

Version:

Salesforce JS library for Apex

40 lines 1.44 kB
"use strict"; /* * Copyright (c) 2021, salesforce.com, inc. * All rights reserved. * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ Object.defineProperty(exports, "__esModule", { value: true }); exports.formatTestErrors = formatTestErrors; exports.getDiagnostic = getDiagnostic; const i18n_1 = require("../i18n"); function formatTestErrors(error) { const matches = error.message?.match(/\bsObject type ["'](.*?)["'] is not supported\b/); if (matches?.[0] && matches?.[1]) { error.message = i18n_1.nls.localize('invalidsObjectErr', [ matches[1], error.message ]); return error; } return error; } function getDiagnostic(record) { const { message, stackTrace } = 'message' in record ? record : { message: record.Message, stackTrace: record.StackTrace }; const matches = stackTrace?.match(/(line (\d+), column (\d+))/); return { exceptionMessage: message, exceptionStackTrace: stackTrace, className: stackTrace ? stackTrace.split('.')[1] : undefined, compileProblem: '', ...(matches && matches[2] && { lineNumber: Number(matches[2]) }), ...(matches && matches[3] && { columnNumber: Number(matches[3]) }) }; } //# sourceMappingURL=diagnosticUtil.js.map