mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 09:56:46 +00:00
Fix.
This commit is contained in:
parent
596a6da241
commit
c1a589c5b6
7078 changed files with 1882834 additions and 319 deletions
33
node_modules/parse-json/index.js
generated
vendored
Normal file
33
node_modules/parse-json/index.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
'use strict';
|
||||
const errorEx = require('error-ex');
|
||||
const fallback = require('json-parse-better-errors');
|
||||
|
||||
const JSONError = errorEx('JSONError', {
|
||||
fileName: errorEx.append('in %s')
|
||||
});
|
||||
|
||||
module.exports = (input, reviver, filename) => {
|
||||
if (typeof reviver === 'string') {
|
||||
filename = reviver;
|
||||
reviver = null;
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
return JSON.parse(input, reviver);
|
||||
} catch (err) {
|
||||
fallback(input, reviver);
|
||||
|
||||
throw err;
|
||||
}
|
||||
} catch (err) {
|
||||
err.message = err.message.replace(/\n/g, '');
|
||||
|
||||
const jsonErr = new JSONError(err);
|
||||
if (filename) {
|
||||
jsonErr.fileName = filename;
|
||||
}
|
||||
|
||||
throw jsonErr;
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue