All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.build.cjs.breadcrumb-log-level.js Maven / Gradle / Ivy

The newest version!
Object.defineProperty(exports, '__esModule', { value: true });

/**
 * Determine a breadcrumb's log level (only `warning` or `error`) based on an HTTP status code.
 */
function getBreadcrumbLogLevelFromHttpStatusCode(statusCode) {
  // NOTE: undefined defaults to 'info' in Sentry
  if (statusCode === undefined) {
    return undefined;
  } else if (statusCode >= 400 && statusCode < 500) {
    return 'warning';
  } else if (statusCode >= 500) {
    return 'error';
  } else {
    return undefined;
  }
}

exports.getBreadcrumbLogLevelFromHttpStatusCode = getBreadcrumbLogLevelFromHttpStatusCode;
//# sourceMappingURL=breadcrumb-log-level.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy