Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Exports the createError
function that creates an error.
The error has a unique id and a reference to the cause, this is to facilitate with logging.
createError
uses boom.wrap
to decorate the error with boom
properties.
createError
takes the following optional params:
code
HTTP status code >= 400. Defaults to 500.message
Error message. Defaults to the default message for code
.cause
The cause of the error.root_error_id
Id of the root cause. Defaults to cause.root_error_id || error_id
.stack_from
Function to start stack trace from. Defaults to createError
.The created error has the following properties added to it:
code
HTTP status codemessage
Error messagecause
The causeerror_id
A unique id stringroot_error_id
A unique id stringoutput
See boomdetails
if cause
is a joi error then the details
array is copied. It is also added to output.payload
.Example:
import { createError } from 'fel';
let error = createError();
// error.code == 500
// error.message == 'Internal Server Error'
// error.error_id == (unique id string)
// error.root_error_id == (unique id string)
createError({ code: 400 });
createError({ code: 400, message: 'cannot process the request' });
function readJsonFile(filename, callback) {
fs.readFile(filename, { encoding: 'utf8' }, (err, str) => {
if (err) {
return callback(createError({ cause: err, message: 'Unable to read the file' }));
}
let obj;
try {
obj = JSON.parse(str);
}
catch (json_err) {
return callback(createError({ cause: json_err, message: 'Unable to parse the file' }));
}
callback(null, obj);
});
}
FAQs
Create errors with HTTP codes and cause refs for use in logging
The npm package fel receives a total of 20 weekly downloads. As such, fel popularity was classified as not popular.
We found that fel demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.