Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@netlify/build-info

Package Overview
Dependencies
Maintainers
23
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netlify/build-info - npm Package Compare versions

Comparing version 7.13.0 to 7.13.1

2

lib/metrics.d.ts
import { type Client, NotifiableError } from '@bugsnag/js';
export type Severity = 'info' | 'warning' | 'error';
/** Report an error to bugsnag */
export declare function report(error: NotifiableError, options?: {
export declare function report(error: NotifiableError | Record<string, any>, options?: {
context?: string;

@@ -6,0 +6,0 @@ severity?: Severity;

import bugsnag from '@bugsnag/js';
const { default: Bugsnag } = bugsnag;
/** Normalize an error to the NotifiableError type */
const normalizeError = (error) => {
// Already in an acceptable NotifiableError format
if (error instanceof Error) {
return error;
}
if (typeof error === 'object' && (error.errorClass || error.name)) {
return error;
}
if (typeof error === 'string') {
// BugSnag suggest sending an Error rather than string to get better stack traces
return new Error(error);
}
// If the error is an object with a message, create a generic Error
if (typeof error === 'object' && error.message) {
return new Error(error.message);
}
// If the error format is unexpected, create a generic Error
return new Error(`Unexpected error format: ${JSON.stringify(error)}`);
};
/** Report an error to bugsnag */
export function report(error, options = {}) {
;
(options.client || Bugsnag).notify(error, (event) => {
const normalizedError = normalizeError(error);
const client = options.client || Bugsnag;
client.notify(normalizedError, (event) => {
for (const [section, values] of Object.entries(options.metadata || {})) {
event.addMetadata(section, values);
}
// If the error is an object with a documentation_url property, it's probably a GitHub API error
if (typeof error === 'object' && 'documentation_url' in error) {
event.addMetadata('Documentation URL', error.documentation_url);
}
event.context = options.context;
event.severity = options.severity || 'error';

@@ -11,0 +37,0 @@ event.context = options.context;

{
"name": "@netlify/build-info",
"version": "7.13.0",
"version": "7.13.1",
"description": "Build info utility",

@@ -76,3 +76,3 @@ "type": "module",

},
"gitHead": "f04cc67a1ebb8ca419e85271a43d28680aaa9896"
"gitHead": "664052bb513e410827e859e9d2f1e72538ddbf09"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc